Consider the following two lines of code. What can you say about s1 and s2?
String s1 = "testing" + "123";
String s2 = new String("testing 123") ;
A) s1 and s2 are both references to the same String object
B) the line declaring s2 is legal Java; the line declaring s1 will produce a syntax error
C) s1 and s2 are both references to different String objects
D) s1 and s2 will compare "equal"
E) none of the above
Correct Answer:
Verified
Q1: What is the function of the dot
Q2: In Java a variable may contain
A) a
Q4: Which of the following will yield a
Q5: Say you write a program that makes
Q6: What is the advantage of putting an
Q8: The String class' compareTo method
A) compares two
Q9: An "alias" is when
A) two different reference
Q10: The advantage(s) of the Random class' pseudo-random
Q11: In the StringMutation program shown in Listing
Q21: Java.text's NumberFormat class includes methods that
A) allow
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents