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

What is the term used to describe when the computer has a condition occur from which it cannot recover?

A) POST error B) Ping of death C) Cold boot D) Blue screen of death

Computer Science & Information Technology

You can use the procedures in a database’s standard modules from anywhere in the database. _________________________

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

Computer Science & Information Technology