Answer: StringBuilder and StringBuffer : Questions « Utility Classes « SCJP


StringBuffer is synchronized

8.33.1.Which of the calls modifies the string s?
8.33.2.Answer: string value
8.33.3.Which is the output of the following code?
8.33.4.Answer: compare two strings
8.33.5.You can subclass java.lang.Math to create your own class(True/False).
8.33.6.Answer: Math class and subclass
8.33.7.Which is the output of the following code fragment?
8.33.8.Answer: Math.cos
8.33.9.After execution of line 2, sbuf still references the same instance.
8.33.10.Answer: StringBuffer reference
8.33.11.What is the output of the following code(string literal comparision)?
8.33.12.Answer: string literal comparision
8.33.13.What is the output of the following code(string literal and reference)?
8.33.14.Answer: string literal and reference
8.33.15.Which of the following are legal Java statements?
8.33.16.Answer: Integer wrapper
8.33.17.Is it a legal statement: List theList = new Vector;
8.33.18.Answer: generic class
8.33.19.Which of the following are legal(enhanced while loop)?
8.33.20.Answer: enhanced while loop
8.33.21.What is the legal clone() methods when subclassing Object?
8.33.22.Answer: clone method
8.33.23.Which of the following classes implement java.util.List?
8.33.24.Answer: java.util.List inheritance
8.33.25.Which of the following are methods of the java.util.SortedSet interface?
8.33.26.Answer: java.util.SortedSet
8.33.27.Which line of code tells a scanner called sc to use a single digit as a delimiter?
8.33.28.Answer: Scanner class
8.33.29.What happens when you try to compile and run this application?
8.33.30.Answer: TreeSet
8.33.31.How to compare two arrays
8.33.32.Answer: java.util.Arrays
8.33.33.StringBuilder is generally faster than StringBuffer(True/False).
8.33.34.Answer: StringBuilder and StringBuffer
8.33.35.StringBuilder is threadsafe; StringBuffer is not(True/False).
8.33.36.Answer: StringBuilder and StringBuffer(2)
8.33.37.The Class class is the superclass of the Object class(True/False).
8.33.38.Answer: Class and Object