Question: What is the output of the following program? String s1 = Welcome to Java; String s2 = new String(Welcome to Java); String s3 =

What is the output of the following program? String s1 =

What is the output of the following program? String s1 = "Welcome to Java"; String s2 = new String("Welcome to Java"); String s3 = "Welcome to Java"; System.out.println("s1==s2 System.out.println("s1==s3 is " + (s1==s2)); is " + (s1==s3));

Step by Step Solution

3.47 Rating (154 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

output s1s2 is false s1s3 is true Explanation In Java there are two types of string objects string l... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!