i tried running the code
class testing {
public static void main(String[] args) {
String s1 = new String("hello");//"hello";
String s2 = new String("hello");//"hello";
if(s1==s2)
System.out.println(true);
else
System.out.println(false);
}
}
when i create strings with new operator the system prints false whereas when strings are created without new operator…it prints true… Kindly help me understand.