单项选择题

阅读下面程序
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=”后输出的值是

A.10
B.4
C.20
D.30
<上一题 目录 下一题>
热门 试题

单项选择题
阅读下面程序: public class ThreadTest public static void main(String args[]) throws Exception int i=0; Hello t=new Hello(); ______; While(true) System.out.println( Good Morning +i++); if(i==2&&t.isAlive()) System.out.println( Main waiting for Hello! ); t.join(); 等待t运行结束 If(i==5)break: class Hello extends Thread int i; public void run() while(true) System.out.println( Hello +i++): If(i==5)break; 为使该程序正确执行,下画线处的语句应是
A.sleep()
B.yield()
C.interrupt()
D.start()
单项选择题
阅读下面程序: public class OperatorsAndExpressions void residual int i=100,j=30; float m=563.5f,n=4.0f; System.out.println(i%j); System.out.println(m%n): public static void main(String args[]) OperatorsAndExpressions OperAndExp=new OperatorsAndExpressions(); 取模运算符在整数和浮点数中的应用 OperAndExp.residual(); 程序运行的结果是
A.10
3.5
B.20
2.5
C.10
4.5
D.20
3.5
相关试题
  • Applet类属______包。
  • 在Java线程中,共享数据的所有访问都必须作...
  • Swing是由纯Java实现的轻量级构件,没有本...
  • 在java.io包中,字符输出流类都是____...
  • 类是变量和______的集合体。