Which of the following code segments correctly declares a String s and gives it a value of "fundamentals"? Select all that apply.
String s = "fundamentals"; String s = ("fundamentals"); String s; s = "fundamentals";
2
New cards
Which of the following commands will print the output below? \/ '`
System.out.print("\\/\n\'`");
3
New cards
A special value that can be assigned to an object that has no value:
null
4
New cards
The correct way to concatenate two Strings is ______.
None of the items listed
5
New cards
Use the following code for questions 2-7: String w1; String w2 = "ants"; String w3 = "flies"; What is stored in w1 by the following? w1 = "type: " + w2;
type: ants
6
New cards
What is stored in w1 by the following? w1 = w3.substring(1, 3);
li
7
New cards
What is stored in w1 by the following? w1 = w3.substring(2);
ies
8
New cards
What is the output? System.out.println(w3.compareTo("bugs"));
4
9
New cards
What is the output? System.out.println(w2.compareTo(w3));
-5
10
New cards
What is stored in w1 by the following? w1 = w2.toUpperCase();