多选题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.
参考解析
解析:
暂无解析
相关考题:
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.
Dense Wavelength Division Multiplexing (DWDM) is an important innovation in optical networks.Which two descriptions best define DWDM?()A、optical technology for transmitting up to 32 channels over multiple fiber strandsB、optical technology for transmitting up to 16 channels over multiple fiber strandsC、a WDM system that is compatible with EDFA technologyD、a technology for transmitting more closely packed optical signals using more sophisticated transceiver designs than CWDM .
Which two statements are true about the hashCode method?()A、 The hashCode method for a given class can be used to test for object equality and object inequality for that class.B、 The hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.C、 The hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.D、 The only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.E、 The hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.
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”);
What two descriptions best define DWDM? ()A、 a WDM system that is compatible with EDFA technologyB、 an optical technology for transmitting up to 16 channels over multiple fiber strandsC、 an optical technology for transmitting up to 32 channels over multiple fiber strandsD、 a technology for transmitting multiple optical signals using less sophisticated transceiver designthen CWDME、 a technology for transmitting more closely packed optical signals using more sophisticatedtransceiver designs than CWDM
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 Team extends java.util.LinkedList { public void addPlayer(Player p) { add(p); } public void compete(Team opponent) { /* more code here */ } } class Player { /* more code here */ } Which two are true?()A、 This code will compile.B、 This code demonstrates proper design of an is-a relationship.C、 This code demonstrates proper design of a has-a relationship.D、 A Java programmer using the Team class could remove Player objects from a Team object.
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.
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?()
A developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in athread-safe manner. Which two can support this design goal?()A、Store the data in a local variable.B、Store the data in an instance variable.C、Store the data in the HttpSession object.D、Store the data in the ServletContext object.E、Store the data in the ServletRequest object.
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
A Company.com developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in a thread-safe manner. Which two can support this design goal?()A、 Store the data in a local variable.B、 Store the data in an instance variable.C、 Store the data in the HttpSession object.D、 Store the data in the ServletContext object.E、 Store the data in the ServletRequest object.
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.
You work as an application developer at Contoso.com. You use Microsoft .NET Framework 3.5 and Microsoft ADO.NET to develop an application. The database on the Microsoft SQL Server 2005 database has two tables that are displayed by using two SqlConnection objects in two different GridView controls. You want the tables to be displayed at the same time with the use a single SqlConnection object. What should you do?()A、 Create a bound connection by using the sp_getbindtoken and the sp_bindsession stored procedures.B、 Enable Multiple Active Result Sets (MARS) in the connection string of the application. C、 Create an exception handler for the connection-busy exception that is thrown on using a single SqlConnection object.D、 Run the two SqlDataReader objects by using a single SqlCommand object.
单选题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.printLn (textString + textBuffer); ) ) What is the output?()
多选题public class Team extends java.util.LinkedList { public void addPlayer(Player p) { add(p); } public void compete(Team opponent) { /* more code here */ } } class Player { /* more code here */ } Which two are true?()AThis code will compile.BThis code demonstrates proper design of an is-a relationship.CThis code demonstrates proper design of a has-a relationship.DA Java programmer using the Team class could remove Player objects from a Team object.
多选题A developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in athread-safe manner. Which two can support this design goal?()AStore the data in a local variable.BStore the data in an instance variable.CStore the data in the HttpSession object.DStore the data in the ServletContext object.EStore the data in the ServletRequest object.
多选题Which two statements are true about the hashCode method?()AThe hashCode method for a given class can be used to test for object equality and object inequality for that class.BThe hashCode method is used by the java.util.SortedSet collection class to order theelements within that set.CThe hashCode method for a given class can be used to test for object inequality, but NOT object equality, for that class.DThe only important characteristic of the values returned by a hashCode method is that the distribution of values must follow a Gaussian distribution.EThe hashCode method is used by the java.util.HashSet collection class to group the elements within that set into hash buckets for swift retrieval.
单选题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
多选题What two descriptions best define DWDM? ()Aa WDM system that is compatible with EDFA technologyBan optical technology for transmitting up to 16 channels over multiple fiber strandsCan optical technology for transmitting up to 32 channels over multiple fiber strandsDa technology for transmitting multiple optical signals using less sophisticated transceiver designthen CWDMEa technology for transmitting more closely packed optical signals using more sophisticatedtransceiver designs than CWDM
多选题A Company.com developer chooses to avoid using SingleThreadModel but wants to ensure that data is updated in a thread-safe manner. Which two can support this design goal?()AStore the data in a local variable.BStore the data in an instance variable.CStore the data in the HttpSession object.DStore the data in the ServletContext object.EStore the data in the ServletRequest object.
多选题Whichtwo 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.EEnitiation of separate design processes to the separation of users
单选题Which methods from the String and StringBuffer classes modify the object on which they are called?()AThe charAt() method of the String class.BThe toUpperCase() method of the String class.CThe replace() method of the String class.DThe reverse() method of the StringBuffer class.EThe length() method of the StringBuffer class.
多选题Dense Wavelength Division Multiplexing (DWDM) is an important innovation in optical networks.Which two descriptions best define DWDM?()Aoptical technology for transmitting up to 32 channels over multiple fiber strandsBoptical technology for transmitting up to 16 channels over multiple fiber strandsCa WDM system that is compatible with EDFA technologyDa technology for transmitting more closely packed optical signals using more sophisticated transceiver designs than CWDM .
多选题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”);