Solved

Given the Following Two Lines of Code, What Can Be

Question 41

Multiple Choice

Given the following two lines of code, what can be said 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 s1 is legal in Java; the line declaring s2 will produce a syntax error.
C) s1 and s2 are references to different String objects.
D) s1 and s2 will compare "equal."
E) None of the above

Correct Answer:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions