Multiple Choice
Consider the statement below:
StringBuilder sb1 = new StringBuilder("a toyota") ;
Which of the following creates a String object with the value "toy"?
A) String res = sb1.subString(2, 5) ;
B) char dest[] = new char[sb1.length() ]; sb1.getChars(2, 5, dest, 0) ;
String res = new String(dest) ;
C) char dest[] = new char[sb1.length]; dest = sb1.getChars(2, 5) ;
String res = new String(dest) ;
D) char dest[] = new char[sb1.length() ]; dest = sb1.getChars(0, 3) ;
String res = new String(dest) ;
Correct Answer:

Verified
Correct Answer:
Verified
Q6: Consider the examples below: <br>A. a string.<br>B.
Q7: The statement <br>s1.startsWith("art")<br>Has the same result as
Q8: The length of a string can be
Q9: A String constructor cannot be passed _.<br>A)
Q10: The statement<br> s1.equalsIgnoreCase(s4)<br>Is equivalent to which of
Q12: Which class is not a type-wrapper class?<br>A)
Q13: Consider the statements below: <br>StringBuilder sb =
Q14: An anonymous String _.<br>A) has no value<br>B)
Q15: Consider the Java segment: <br>String line1 =
Q16: To find the character at a certain