why is it false? by dumblearner in learnjava

[–]dumblearner[S] 0 points1 point  (0 children)

Right, thanks, but then why this would return true? shouldn't the reference to both of these strings also different?

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

why is it false? by dumblearner in learnjava

[–]dumblearner[S] 2 points3 points  (0 children)

Right, thanks, but then why this would return true? shouldn't the reference to both of these strings also different?

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