Top Posters
Since Sunday
5
k
4
c
4
4
M
3
t
3
i
3
B
3
k
3
m
3
c
3
o
3
New Topic  
studymite studymite
wrote...
Posts: 491
4 years ago
What is the output of the following code?

public class Test {
public static void main(String[] args) {
String s1 = new String("Welcome to Java!");
String s2 = new String("Welcome to Java!");
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 different String objects

▸ s1 and s2 reference to the same String object
Textbook 
Introduction to Java Programming, Comprehensive Version

Introduction to Java Programming, Comprehensive Version


Edition: 10th
Author:
Read 60 times
1 Reply
Replies
Answer verified by a subject expert
sadeensadeen
wrote...
Posts: 409
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

studymite Author
wrote...

4 years ago
Just got PERFECT on my quiz
wrote...

Yesterday
This calls for a celebration Person Raising Both Hands in Celebration
wrote...

2 hours ago
Thanks for your help!!
New Topic      
Explore
Post your homework questions and get free online help from our incredible volunteers
  879 People Browsing
Related Images
  
 2572
  
 321
  
 58
Your Opinion
Who will win the 2024 president election?
Votes: 8
Closes: November 4

Previous poll results: Who's your favorite biologist?