StringBuffer( String s )方法分配了s大小的空间和()个字符的缓冲区。A、12B、14C、16D、18

StringBuffer( String s )方法分配了s大小的空间和()个字符的缓冲区。

  • A、12
  • B、14
  • C、16
  • D、18

相关考题:

下面的哪些程序段可能导致错误? ( ) Ⅰ: String s = "Gone with the wind"; String t = "good "; String k = s + t; Ⅱ: String s = "Gone with the wind"; String t; t = s[3] + "one"; Ⅲ: String s = "Gone with the wind"; String standard = s.toUpperCase(); Ⅳ: String s = "home directory"; String t = s-"directory":A.Ⅱ、ⅢB.Ⅱ、ⅣC.Ⅰ、ⅣD.Ⅲ、Ⅳ

request对象可以使用( )方法获取表单中某输入框提交的信息。A.getParameter(String s)B.getValue(String s)C.getParameterNames(String s)D.getParameterValue(String s)

为了从HTML文件中获取参数,在Applet程序中应该编写的代码是 ( )A.在start()方法中加入语句String s=getParameter("buttonLabel");B.在init()方法中加入语句String s=Parameter("buttonLabel");C.在init()方法中加入语句String s=getParameter("BUTTONLABEL");D.在start()方法中加入语句String s=getParameter("BUTTONLABEL");

下列的哪个程序段可能导致错误? ( )A.String s="hello"; String t="good"; String k=s+t;B.String s="hello"; String t; t=s[3]+"one";C.String s="hello"; String standard=s.toUpperCase();D.String s="hello"; String t=s+"good";

关于以下代码段的说法中正确的是( )。 (1)String s="abcde"; (2)StringBuffer s1=new StringBuffer("abcde"); (3)if(s.equals(s1)) (4)s1=null; (5)if(sequals(s)) (6)s=null:A.第(1)行编译错误,String 的构造器必须明确调用B.第(3)行编译错误,因为s与s1有不同的类型C.编译成功,但执行时在第(5)行有异常抛出D.编译成功,执行过程中也没有异常抛出

设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6

下面的哪些程序片断可能导致错误() A、String s = "Gone with the wind";  String t = " good ";  String k = s + t;B、String s = "Gone with the wind";  String t;  t = s[3] + "one";C、String s = "Gone with the wind";  String standard = s.toUpperCase();D、String s = "home directory"; String t = s - "directory"

public class TestString3 {  public static void main(String[] args) {  // insert code here  System.out.println(s);  }  }  Which two code fragments, inserted independently at line 3, generate the output 4247?()A、 String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;B、 StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);C、 StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);D、 StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);E、 StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);

String与StringBuffer的区别()。A、String是不可变的对象,StringBuffer是可以再编辑的B、String是常量,StringBuffer是变量C、String是可变的对象,StringBuffer是不可以再编辑的D、以上说法都不正确

下面哪个是对字符串String的正确定义()。A、String s1=null;B、String s2=’null’;C、String s3=(String)‘abc’;D、String s4=(String)‘/uface’;

下列不是 String 类的方法的是()A、charAt(int index)B、indexOf(String s)C、beginWith(String s)D、endsWith(String s)

request对象可以使用()方法获取表单中某输入框提交的信息。A、getParameter(String s)B、getValue(String s)C、getParameterNames(String s)D、getParameterValue(String s)

String类和StringBuffer类的区别是什么?StringBuffer类提供了哪些独特的方法?

定义有StringBuffer s1=new StringBuffer(10);s1.append(“1234”)则s1.length()和s1.capacity()分别是多少?A、4;10B、4;4C、10;10D、10;4

Which methods from the String and StringBuffer classes modify the object on which they are called?()  A、The charAt() method of the String class.B、The toUpperCase() method of the String class.C、The replace() method of the String class.D、The reverse() method of the StringBuffer class.E、The length() method of the StringBuffer class.

public class SyncTest{   public static void main(String args) {    final StringBuffer s1= new StringBuffer();    final StringBuffer s2= new StringBuffer();    new Thread () {    public void run() {   synchronized(s1) {   s2.append(“A”);   synchronized(s2) {    s2.append(“B”);    System.out.print(s1);    System.out.print(s2);   }   }    }    }.start();   new Thread() {   public void run() {   synchronized(s2) {  s2.append(“C”);  synchronized(s1) {   s1.append(“D”);  System.out.print(s2);  System.out.print(s1);   }   }    }   }.start();   }   }   Which two statements are true? ()A、 The program prints “ABBCAD”B、 The program prints “CDDACB”C、 The program prints “ADCBADBC”D、 The output is a non-deterministic point because of a possible deadlock condition.E、 The output is dependent on the threading model of the system the program is running on.

Which of the following fragments might cause errors?()    A、 String s = "Gone with the wind";String t = " good ";String k = s + t;B、 String s = "Gone with the wind";String t;t = s[3] + "one";C、 String s = "Gone with the wind";String standard = s.toUpperCase();D、 String s = "home directory";String t = s - "directory";

单选题StringBuffer( String s )方法分配了s大小的空间和()个字符的缓冲区。A12B14C16D18

多选题public class TestString3 {  public static void main(String[] args) {  // insert code here  System.out.println(s);  }  }  Which two code fragments, inserted independently at line 3, generate the output 4247?()AString s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;BStringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);CStringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);DStringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);EStringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);

单选题Which methods from the String and StringBuffer classes modify the object on which they are called?()AThe charAt() method of the String class.BThe toUpperCase() method of the String class.CThe replace() method of the String class.DThe reverse() method of the StringBuffer class.EThe length() method of the StringBuffer class.

多选题下面哪段语法执行正确()AString s = Gone with the wind;String t =  good ;String k = s + t;BString s = Gone with the wind;String t; t = s[3] + one;CString s = Gone with the wind;String standard = s.toUpperCase();DString s = home directory;String t = s - directory;

问答题String类和StringBuffer类的区别是什么?StringBuffer类提供了哪些独特的方法?

多选题Which of the following fragments might cause errors?()AString s = Gone with the wind;String t =  good ;String k = s + t;BString s = Gone with the wind;String t;t = s[3] + one;CString s = Gone with the wind;String standard = s.toUpperCase();DString s = home directory;String t = s - directory;

判断题设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6A对B错

多选题下面的哪些程序片断可能导致错误()AString s = Gone with the wind;  String t =  good ;  String k = s + t;BString s = Gone with the wind;  String t;  t = s[3] + one;CString s = Gone with the wind;  String standard = s.toUpperCase();DString s = home directory; String t = s - directory

单选题下列不是 String 类的方法的是()AcharAt(int index)BindexOf(String s)CbeginWith(String s)DendsWith(String s)

多选题public class SyncTest{   public static void main(String args) {    final StringBuffer s1= new StringBuffer();    final StringBuffer s2= new StringBuffer();    new Thread () {    public void run() {   synchronized(s1) {   s2.append(“A”);   synchronized(s2) {    s2.append(“B”);    System.out.print(s1);    System.out.print(s2);   }   }    }    }.start();   new Thread() {   public void run() {   synchronized(s2) {  s2.append(“C”);  synchronized(s1) {   s1.append(“D”);  System.out.print(s2);  System.out.print(s1);   }   }    }   }.start();   }   }   Which two statements are true? ()AThe program prints “ABBCAD”BThe program prints “CDDACB”CThe program prints “ADCBADBC”DThe output is a non-deterministic point because of a possible deadlock condition.EThe output is dependent on the threading model of the system the program is running on.