Top Posters
Since Sunday
j
3
s
3
j
2
J
2
e
2
n
2
t
2
d
2
b
2
t
2
J
2
b
2
New Topic  
Lopezj273 Lopezj273
wrote...
Posts: 447
4 years ago
What is the output of the following code?

public class Test {
public static void main(String[] args) {
String s1 = "Welcome to Java!";
String s2 = s1;
if (s1 == s2)
System.out.println("s1 and s2 reference to the same String object");
else
System.out.println("s1 and s2 reference to different String objects");
}
}


▸ s1 and s2 reference to the same String object

▸ s1 and s2 reference to different String objects
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 65 times
1 Reply
Replies
Answer verified by a subject expert
wasanwasan
wrote...
Posts: 368
4 years ago
Sign in or Sign up in seconds to unlock everything for free
More solutions for this book are available here

Related Topics

Lopezj273 Author
wrote...

4 years ago
You make an excellent tutor!
wrote...

Yesterday
I appreciate what you did here, answered it right Smiling Face with Open Mouth
wrote...

2 hours ago
Correct Slight Smile TY
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  948 People Browsing
Related Images
  
 338
  
 943
  
 266
Your Opinion
Where do you get your textbooks?
Votes: 447