When using versions of Java technology earlier than 5.0.
When sharing a StringBuffer among multiple threads.
When using the java.io class StringBufferInputStream.
When you plan to reuse the StringBuffer to build more than one string.
Enitiation of separate design processes to the separation of users
第1题:
5 string 和 stringbuffer的区别?
它们都是处理字符串的类,但是它们有一个最大的区别,那就是,String对象是存储你不能改动的文本字符
串,相反,如果你希望改动,则应使用StringBuffer类作为替换.
第2题:
Whichtwo scenarios are NOT safe to replace a StringBuffer object with a StringBuilder object?()
第3题:
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?()
第4题:
String与StringBuffer最大的区别在于()
第5题:
STRING与STRINGBUFFER的区别是什么?
第6题:
A technician installed a new application on a Windows XP desktop. After the application wasinstalled, the technician rebooted the desktop and received a bluescreen error. Which of thefollowing steps should the technician perform?() (Select TWO).
第7题:
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?()
第8题:
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?()
第9题:
String s = “123456789”; s = (s-”123”).replace(1,3,”24”) - “89”;
StringBuffer s = new StringBuffer(”123456789”); s.delete(0,3).replace( 1,3, “24”).delete(4,6);
StringBuffer s = new StringBuffer(”123456789”); s.substring(3,6).delete( 1 ,3).insert(1, “24”);
StringBuilder s = new StringBuilder(”123456789”); s.substring(3,6).delete( 1 ,2).insert( 1, “24”);
StringBuilder s = new StringBuilder(”123456789”); s.delete(0,3).delete( 1 ,3).delete(2,5).insert( 1, “24”);
第10题:
s.replace(6,9,World);
s.replace(6,10,World);
s=World;
s=replace(java,World);
第11题:
When using versions of Java technology earlier than 5.0.
When sharing a StringBuffer among multiple threads.
When using the java.io class StringBufferInputStream.
When you plan to reuse the StringBuffer to build more than one string.
第12题:
This code is NOT thread-safe.
The programmer can replace StringBuffer with StringBuilder with no other changes.
This code will perform well and converting the code to use StringBuilder will not enhance the performance.
This code will perform poorly. For better performance, the code should be rewritten: return “<“+ this.name + “>”;
第13题:
设StringBuffer s=new StringBuffer("Sunday"),那么s.capacity( )的值为6
第14题:
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?()
第15题:
关于 String、StringBuffer 和 StringBuilder 说法错误的是()
第16题:
关于String和StringBuffer,下面那些是正确的:()
第17题:
String类和StringBuffer类的区别是什么?StringBuffer类提供了哪些独特的方法?
第18题:
关于String,StringBuilder以及StringBuffer,描述错误的是()。
第19题:
Which methods from the String and StringBuffer classes modify the object on which they are called?()
第20题:
常量字符串使用String,非常量字符串使用StringBuffer。
使用StringBuffer的时候设置初始容量。
尽量使用StringTokenizer代替indexOf()和substring()。
尽量不要使用StringBuffer,StringTokenizer类。
第21题:
synchronize the log method
replace StringBuilder with StringBuffer
No change is necessary, the current MyLogger code is already thread-safe.
replace StringBuilder with just a String object and use the string concatenation (+=) within the log method
第22题:
The charAt() method of the String class.
The toUpperCase() method of the String class.
The replace() method of the String class.
The reverse() method of the StringBuffer class.
The length() method of the StringBuffer class.
第23题:
第24题: