What will be the output of the following code?

Last Updated :
Discuss
Comments

What will be the output of the following code?

Java
String s1 = new String("Java");
String s2 = new String("Java");
System.out.println(s1 == s2);

true

false

Compilation Error


Runtime Exception

Share your thoughts in the comments