Which of the following creates a String object with the value "toy"?

Consider the statement below:
```
StringBuilder sb1 = new StringBuilder("a toyota");
```

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

Pixels are most closely associated with ________

A) monitors B) printers C) processors D) speakers

Computer Science & Information Technology

A library book reservation service is a good example of a use for a(n) ________ server

Fill in the blank(s) with correct word

Computer Science & Information Technology

Text added to a picture or object that helps people using a screen reader understand what the object is

a. Text effects b. Formatted text c. Alternative text

Computer Science & Information Technology

Lines are numbered in the ____________________ margin on pleadings.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology