'If s3==s4 is false, then how come s1==s2 becomes true? [duplicate]

I am very wondering after executing the below java code.

public class HelloWorld {
    public static void main(String...strings) {
  String s3="abc";
  String s4="abc";
  System.out.println("Result::"+s3==s4);//1
  
  String s1 = "abc";
  String s2 = "abc";
  
  System.out.println(s1 == s2);//2
  
 }
 
 public static void main(String args) {
  System.out.println("From Static Method");
  HelloWorld.main("");
 }

}

Output:

The output is

Result:: false
true

If statement 1 is identical to statement 2, then why statement 1 is false, whereas statement 2 is true



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source