网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
判断题
设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6
A

B


参考答案

参考解析
解析: 暂无解析
更多 “判断题设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6A 对B 错” 相关考题
考题 ( 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 ) 10B ) 4C ) 20D ) 30

考题 请阅读下面程序 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

考题 下面的程序段执行后,输出的结果是以下哪个选项( )。StringBuffer buf=new StringBuffer("Beijing2008");buf.insert(7,"@");System.out.println(buf.toString()); A、Beijing@2008B、@Beijing2008C、Beijing2008@D、Beijing#2008

考题 执行下列程序后,输出结果为( )。 public class Test { public static void main (String[] args) { StringBuffer sb = new StringBuffer("北京 2008" ); System. out. println ("length =" + sb. length ( ) ); } }A.length = 8B.length = 10C.length = 6D.length = 20

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

考题 字符串的append函数可以添加多种内容,以下append函数的使用中,错误的是() StringBuffer strb1 = new StringBuffer();  Integer intObj = new Integer(33);A、strb1.append(3.14159);B、strb1.append(’数’);C、strb1.append(true);D、strb1.append(intObj);

考题 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”);

考题 Public class test (  Public static void stringReplace (String text)  (  Text = text.replace (‘j’ , ‘i’);  )  public static void bufferReplace (StringBuffer text)  (  text = text.append (“C”)  )   public static void main (String args[]}  (  String textString = new String (“java”);  StringBuffer text BufferString = new StringBuffer (“java”);  stringReplace (textString);  BufferReplace (textBuffer);  System.out.printLn (textString + textBuffer);  )  )   What is the output?()

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

考题 关于 String、StringBuffer 和 StringBuilder 说法错误的是()A、String 创建的字符串是不可变的B、StringBuffer 创建的字符串是可变的,而所引用的地址一直不变C、StringBuffer 是线程安全的,因此性能比 StringBuilder 好D、StringBuilder 没有实现线程安全,因此性能比 StringBuffer 好

考题 String与StringBuffer最大的区别在于()A、它们没有区别B、String对原字符串的拷贝进行操作,而StringBuffer对原字符串本事操作C、StringBuffer拥有更多相关函数D、String更节省空间

考题 关于String和StringBuffer,下面那些是正确的:()A、常量字符串使用String,非常量字符串使用StringBuffer。B、使用StringBuffer的时候设置初始容量。C、尽量使用StringTokenizer代替indexOf()和substring()。D、尽量不要使用StringBuffer,StringTokenizer类。

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

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

考题 Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  buffer.append(this.name);  buffer.append(‟‟);  return buffer.toString();  }  Which is true?() A、 This code is NOT thread-safe.B、 The programmer can replace StringBuffer with StringBuilder with no other changes.C、 This code will perform well and converting the code to use StringBuilder will not enhance the performance.D、 This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

考题 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.

考题 StringBuffer对象中的值是不可变的

考题 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.

考题 以下语句的含义是() char[] arrcrlf={13,10};  String crlf=new String(arrcrlf);  stringBuffer dest = new StringBuffer("西行漫记");  dest.append(crlf); A、字符串"西行漫记"不变B、字符串"西行漫记"的最后一个字被删除C、语句存在语法错误D、在字符串"西行漫记"的后面加回车换行符

考题 多选题关于String和StringBuffer,下面那些是正确的:()A常量字符串使用String,非常量字符串使用StringBuffer。B使用StringBuffer的时候设置初始容量。C尽量使用StringTokenizer代替indexOf()和substring()。D尽量不要使用StringBuffer,StringTokenizer类。

考题 多选题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?()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.

考题 判断题StringBuffer对象中的值是不可变的A 对B 错

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

考题 单选题Given this method in a class:  public String toString() {  StringBuffer buffer = new StringBuffer();  buffer.append(‟‟);  return buffer.toString();  }  Which is true?()A  This code is NOT thread-safe.B  The programmer can replace StringBuffer with StringBuilder with no other changes.C  This code will perform well and converting the code to use StringBuilder will not enhance the performance.D  This code will perform poorly. For better performance, the code should be rewritten: return ““+ this.name + “”;

考题 填空题Public class test (    Public static void stringReplace (String text) (    Text = text.replace („j„ , „i„);    )      public static void bufferReplace (StringBuffer text) (    text = text.append (“C”)   )      public static void main (String args ){  String textString = new String (“java”);    StringBuffer text BufferString = new StringBuffer (“java”);      stringReplace (textString);    BufferReplace (textBuffer);      System.out.printIn (textString + textBuffer);    }   )   What is the output?()

考题 多选题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.