Why does first two eg give true when a check done on them using if(x==y) but 3rd and 4th case give false?
eg1: String x = "Hello", y="Hello"
eg2: String x = "Hello";
String y= "Hello";
eg3: String x="Hello";
String y = new String("Hello");
eg4: String x = new String("Hello");
String y = new String("Hello");