Output of the following code

Posted by terrific on Stack Overflow See other posts from Stack Overflow or by terrific
Published on 2010-03-24T05:52:53Z Indexed on 2010/03/24 6:03 UTC
Read the original article Hit count: 187

Filed under:
|
String s1 = "Amit";                 //true
String s2 = "Amit";                 //true
String s3 = new String("abcd");     //true
String s4 = new String("abcd");     //false
System.out.println(s1.equals(s2));  //true
System.out.println((s1==s2));       //true
System.out.println(s3.equals(s4));  //false
System.out.println((s3==s4));       //false

Assume it to be in main why the output of the above code is

true true true false and not true true false false???

© Stack Overflow or respective owner

Related posts about java

Related posts about oop