Solved

Consider the Statement Below

Question 11

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions