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

b. char dest[] = new char[sb1.length()];
sb1.getChars(2, 5, dest, 0);
String res = new String(dest);

Computer Science & Information Technology

You might also like to view...

Which of the following statements is false?

a. Variables declared in a particular function’s body are local variables, which can be used only in that function. b. When a function terminates, the values of its local variables are preserved. c. A function’s parameters also are local variables of that function. d. The argument types in the member function call must be consistent with the types of the corresponding parameters in the member function’s definition.

Computer Science & Information Technology

Which control is used for placing objects, like RadioButtons, together? This control not only offers the benefit of visual appearance, but also helps during design because you can set properties that impact all the associated objects.

A. Items B. Collection C. PanelBox D. GroupBox

Computer Science & Information Technology