(难度:中等)StringBuilder是线程不安全的,通常效率比StringBuffer更高

(难度:中等)StringBuilder是线程不安全的,通常效率比StringBuffer更高

相关考题:

String 字符串常量,StringBuffer 字符串变量(线程安全),StringBuilder 字符串变量(非线程安全)

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

用于保存创建后可变的字符串对象的类是()。A、String类B、StringBuffer类C、Character类D、StringBuilder类

关于String,StringBuilder以及StringBuffer,描述错误的是()。A、对String对象的任何改变都不影响到原对象,相关的任何change操作都会生成新的对象B、StringBuffer是线程安全C、StringBuilder是线程安全D、可以修改StringBuilder和StringBuffer的内容

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 two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()A、When using versions of Java technology earlier than 5.0.B、When sharing a StringBuffer among multiple threads.C、When using the java.io class StringBufferInputStream.D、When you plan to reuse the StringBuffer to build more than one string.

Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()A、When using versions of Java technology earlier than 5.0.B、When sharing a StringBuffer among multiple threads.C、When using the java.io class StringBufferInputStream.D、When you plan to reuse the StringBuffer to build more than one string.

通常DPCM比PCM具有更高的传输效率。

单选题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 + “”;

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

单选题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 + “”;

单选题关于String,StringBuilder以及StringBuffer,描述错误的是()。A对String对象的任何改变都不影响到原对象,相关的任何change操作都会生成新的对象BStringBuffer是线程安全CStringBuilder是线程安全D可以修改StringBuilder和StringBuffer的内容

单选题关于String,StringBuilder以及StringBuffer,描述错误的是()。A对String对象的任何改变都不影响到原对象,相关的任何change操作都会生成新的对象BStringBuffer是线程安全CStringBuilder是线程安全D可以修改StringBuilder和StringBuffer的内容

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

单选题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 + “”;

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

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

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

多选题Which two scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()AWhen using versions of Java technology earlier than 5.0.BWhen sharing a StringBuffer among multiple threads.CWhen using the java.io class StringBufferInputStream.DWhen you plan to reuse the StringBuffer to build more than one string.

(难度:中等)如果字符串对象经常改变的情况下,操作String类型比操作StringBuffer类型效率更高。

(难度:中等)start() 方法用于定义线程的执行体

(难度:中等)JavaScript是多线程语言

(难度:中等)拼接静态字符串时,用量用+;拼接动态字符串时尽量用StringBuffer或StringBuilder的apend,减少构造过多的String对象。