[单选题]

( 20 )请阅读下面程序

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

[单选题]请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for

  • 查看答案
  • 请阅读下面程序 public class ThreadTest {public

    [单选题]请阅读下面程序 public class ThreadTest { public static void main(String args[]) throws Exception{ int i=0; Hello t=new Hello(); while(true) { System.out.println("Good Moming"+i++); if (i==2 && t.isAlive()) { System. out.println("Main waiting for

  • 查看答案
  • 请阅读下面程序public class Test {public static

    [主观题]请阅读下面程序public class Test {public static void main (String[] args) {int i,j;for (i=1;i<5;i++) {for (j=1;j<=i;j++)system.out.print (i+"X"+j+"="+i*j+" ");System.out.println();}}}程序执行完后,i循环和j循环执行的次数分别是[ ]。

  • 查看答案
  • 请阅读下面程序 public class ThreadTest{public s

    [单选题]请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys

  • 查看答案
  • 请阅读下面程序 public class ThreadTest{public s

    [单选题]请阅读下面程序 public class ThreadTest{ public static void main(String args[]) ( Thread t1=new Thread(new Hello()); Thread t2=new Thread(new Hello()); t1.start(); t2.start(); } } class Hello implements Runnable { int i; public void run() { while(true) { Sys

  • 查看答案
  • 请阅读下面程序public class OperatorsAndExpressi

    [单选题]请阅读下面程序 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 perAndExp=new OperatorsAndE

  • 查看答案
  • 请阅读下面程序public class ExampleStringBuffer{

    [单选题]请阅读下面程序 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.10B.4C.20D.30

  • 查看答案
  • 请阅读下面程序public class ExampleStringBuffer{

    [单选题]请阅读下面程序 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.10B.4C.20D.30

  • 查看答案
  • ( 17 )请阅读下面程序public class OperatorsAndEx

    [单选题]( 17 )请阅读下面程序public class OperatorsAndExpressions {void residuals {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 Operator

  • 查看答案
  • 请阅读下面程序public class ForLoopStatement {pu

    [单选题]请阅读下面程序 public class ForLoopStatement { public static void main(string []args){ int i,j; for (i=1; i<5; i++) { //i循环 for (j=1;j<=i;j++) //j循环 System.out.print(i+"×"+j+"="+i*j+" "); System.out.println(); } } } 程序完成后,i循环和j循环执行的次数分别是A.4,10B.8,9C.9

  • 查看答案
  • ( 20 )请阅读下面程序public class ExampleStringB