请阅读如下程序。 public class ExampleStringBuffer { public static void main (String[] args) { StringBuffer sb=new StringBuffer ("test"); System.out.println ("buffer= "+sb); System.out.println ("length= "+sb.length ()); } } 程序运行结果中在“length=”后输出的值是______。
查看答案
循环语句中经常加入continue语句完成特定的功能,则执行continue语句后______。
A. 跳过循环体下面的语句,继续下次循环
B. 再次循环前不需要判断终止条件
C. 跳出循环
D. 以上说法都不正确
下列程序的执行结果是______。 public class Test { public static void main(String[] args) { int[] x={0, i,2,3}; for(int i=0;i<3;i+=2) { try{ System.out.println(x[i+2]/x[i]+x[i+1]); }catch(ArithmeticException e) { System.out.println("error1"); }catch(Exception e) { System.out.println ("error2"); } } } }
A. error1
B. error2
C. error1 error2
D. 2 error2
在多分支语句switch(表达式){}中,表达式不可以返回______。
A. 短整型
B. 字符型
C. 接口型
D. 整型
阅读如下代码。 if(x==0) { System.out.println("冠军");} else if(x>-3) { System.out.println("亚军");} else{ System.out.println("季军");} 若要求打印字符串“季军”,则变量x的取值范围是______。
A. x=0&x<=-3
B. x>0
C. x>-3
D. x<=-3