OCJP(310-065)

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

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

如果没有搜索结果,请直接 联系老师 获取答案。
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

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.

正确答案:C,E

第2题:

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”);

正确答案:B,E

第3题:

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, B

第4题:

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.

正确答案:D

第5题:

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

正确答案:B

第6题:

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

正确答案:A,B

第7题:

What two descriptions best define DWDM? ()

  • A、 a WDM system that is compatible with EDFA technology
  • B、 an optical technology for transmitting up to 16 channels over multiple fiber strands
  • C、 an optical technology for transmitting up to 32 channels over multiple fiber strands
  • D、 a technology for transmitting multiple optical signals using less sophisticated transceiver designthen CWDM
  • E、 a technology for transmitting more closely packed optical signals using more sophisticatedtransceiver designs than CWDM

正确答案:A,E

第8题:

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 strands
  • B、optical technology for transmitting up to 16 channels over multiple fiber strands
  • C、a WDM system that is compatible with EDFA technology
  • D、a technology for transmitting more closely packed optical signals using more sophisticated transceiver designs than CWDM .

正确答案:C,D

第9题:

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.

正确答案:A,D

第10题:

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?()


正确答案:javajavaC

更多相关问题