问答题String/StringBuilder的异同

问答题
String/StringBuilder的异同

参考解析

解析: 暂无解析

相关考题:

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.

下列的哪个程序段可能导致错误? ( )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";

已知类 String 的原型为class string{public:string(const char *str=null);//普通构造函数string(const string other);//拷贝构造函数---string(void);string operate=(const string other);//赋值函数private:char * m-data;//用于保存字符串};请编写 string 的上述4 个函数

STRING和STRINGBUILDER区别

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

下列的哪个程序段可能导致错误?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";

System.String和System.StringBuilder有什么区别?

Whichtwo 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.E、Enitiation of separate design processes to the separation of users

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的异同

在JAVA EE中,request对象的()方法可以获取页面请求中一个表单组件对应多个值时的用户的请求数据。A、String getParameter(String name)B、String[] getParameter(String name)C、String getParameterValuses(String name)D、String[] getParameterValues(String name)

关于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 + “”;

public class MyLogger {  private StringBuilder logger = new StringBuuilder();  public void log(String message, String user) {  logger.append(message);  logger.append(user);  }  }  The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?() A、 synchronize the log methodB、 replace StringBuilder with StringBufferC、 No change is necessary, the current MyLogger code is already thread-safe.D、 replace StringBuilder with just a String object and use the string concatenation (+=) within the log method

单选题你正在为一家公司制作ASP.NET页面,页面采用字符串连接方式来集中多邮件信息的数据并组织数据格式使之在页面上显示。你必须保证页面显示尽可能快,你该怎么做?()A采用StringBuilder 对象的Appen 方法来写代码B采用String 对象的Substring 方法来写代码C采用String 对象的Concat 方法来写代码D用操作符+连接字符串

问答题C#String类型比stringBuilder类型的优势是什么?

单选题Given: 22.StringBuilder sb1 = new StringBuilder("123"); 23.String s1 = "123"; 24.// insert code here 25.System.out.println(sb1 + " " + s1); Which code fragment, inserted at line 24, outputs "123abc 123abc"?()Asb1.append(abc); s1.append(abc);Bsb1.append(abc); s1.concat(abc);Csb1.concat(abc); s1.append(abc);Dsb1.concat(abc); s1.concat(abc);Esb1.append(abc); s1 = s1.concat(abc);

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

单选题public class MyLogger {  private StringBuilder logger = new StringBuuilder();  public void log(String message, String user) {  logger.append(message);  logger.append(user);  }  }  The programmer must guarantee that a single MyLogger object works properly for a multi-threaded system. How must this code be changed to be thread-safe?()A synchronize the log methodB replace StringBuilder with StringBufferC No change is necessary, the current MyLogger code is already thread-safe.D replace StringBuilder with just a String object and use the string concatenation (+=) within the log method

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

单选题C#中String和StringBuilder的区别,下列描述正确的是()。AString在进行运算时会产生一个新的实例,而StringBuilder则不会BStringBuilder是引用类型而String是值类型CString类型可以隐式转换为StringBuilder类型DStringBuilder在进行运算时会产生一个新的实例,而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 好

问答题System.String和System.StringBuilder有什么区别?