String string1 = \"Hi there\"; String string2 = \"Hi\"; String string3 = \"Hi\"; System.out.println(string1.substring(0, string2.length()) == string2); //1 System.o
The == operator is checking if the two OBJECTS are equal (are they references to the same object), not comparing the values containes therein.