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


参考解析

解析: 暂无解析

相关考题:

单选题Given a method that must ensure that its parameter is not null: 11. public void someMethod(Object value) { 12. // check for null value ... 20. System.out.println(value.getClass()); 21. } What inserted at line 12, is the appropriate way to handle a null value?()Aassert value == null;Bassert value != null, value is null;Cif (value == null) { throw new AssertionException(value is null); }Dif (value == null) { throw new IllegalArgumentException(value is null); }

单选题Given: What is the result?()A Compilation fails.B An exception is thrown at runtime.C The code executes and prints "running".D The code executes and prints "runningrunning".E The code executes and prints "runningrunningrunning".

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

单选题Which capability exists only in java.io.FileWriter?()AClosing an open stream.BFlushing an open stream.CWriting to an open stream.DWriting a line separator to an open stream.

单选题Given: What is the result?()A 2.1.0B 2.1.1C 3.2.1D 3.2.2

多选题Given a class whose instances, when found in a collection of objects, are sorted by using the compare To method, which two statements are true?()AThe class implements java.lang.Comparable.BThe class implements java.util.Comparator.CThe interface used to implement sorting allows this class to define only one sort sequence.DThe interface used to implement sorting allows this class to define many different sort sequences.

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