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...

(Polynomial Class) Develop class Polynomial. The internal representation of a Polynomial is an array of terms. Each term contains a coefficient and an exponent, e.g., the term 2x4 has the coefficient 2 and the exponent 4. Develop a complete class containing proper constructor and destructor functions as well as set and get functions. The class should also provide the following overloaded operator

capabilities: a) Overload the addition operator (+) to add two Polynomials. b) Overload the subtraction operator (-) to subtract two Polynomials. c) Overload the assignment operator to assign one Polynomial to another. d) Overload the multiplication operator (*) to multiply two Polynomials. e) Overload the addition assignment operator (+=), subtraction assignment operator (-=), and multiplication assignment operator (*=).

Computer Science & Information Technology

When working with complex animations, it is often helpful to turn on ____.

A. onion skinning B. Timelines C. scrubbing D. reframing

Computer Science & Information Technology

You can change one type of chart to another by clicking the Change Chart Type button on the Change Tools Design tab. __________________________

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

What are the rules for naming variables in Visual Basic? Providing examples of the good and the bad, discuss what impact good programming practice has on the naming of variables.

What will be an ideal response?

Computer Science & Information Technology