I am running this program. To check string pool concept. I refer this link and added two more lines with equals method from Object class in java. Why I am getting different output for objRef1==objRef2 vs objRef1.equals(objeRef2). In my opinion they should be same.
public class Abc2 {
public static void main(String[] args) {
String s1 = "Cat";
String s2 = "Cat";
String s3 = new String("Cat");
System.out.println("s1 == s2 :"+(s1==s2));
System.out.println("s1.equals(s2) :"+(s1.equals(s2)));
System.out.println("s1 == s3 :"+(s3==s2));
System.out.println("s1.equals(s3) :"+(s3.equals(s2)));
}
}