Question 1 of 10
What text does this Java code display?
System.out.print("fjor" + "d");
- A. fjor d
- B. fjord
- C. d+fjor
- D. fjor+d
What text does this Java code display?
System.out.print("fjor" + "d");
String objects are immutable. What text does this caller display?
String a = "oak";
String b = a;
a = a + "en";
System.out.print(a + "," + b);
What text does this Java code display?
System.out.print(3 + 1 + "ketch");
DockTag.toString is supplied as shown. What text does this caller display?
class DockTag {
private String id;
public DockTag(String code) {
id = code;
}
public String toString() {
return "[" + id + "]";
}
}
DockTag t = new DockTag("Y7");
System.out.print("id=" + t);
What text does this Java code display?
String w = "glacier";
System.out.print(w.length());
What text does this Java code display?
String w = "glacier";
System.out.print(w.substring(1, 4));
What text does this Java code display? Brackets mark the result.
String w = "glacier";
System.out.print("[" + w.substring(3, 3) + "]");
What text does this Java code display?
String w = "harbor";
System.out.print(w.indexOf("ar"));
What text does this Java code display?
String p = "ketch";
String q = "Ketch";
System.out.print(p.equals(q));
Which description of "fjord".compareTo("glen") is correct?