String is a non mutable class i.e once we create an object of String class like we created in the example below its value will never change.
So if we change the value to which s1 points to it will not change the content of "Hello" but instead s1 will point to "Hello World" a new object and old object "Hello" will become inaccessible.
String s1 = "Hello";
String s2 = new String("Hello");
String s3 = "Hello";//Here no new object will be created as s1 and s3 will point to the same memory location
//so s1==s3 will return true as we are checking memory location and not the actual content
String s4 = new String("Hello"); //Here a new object will be created as s2 and s4 will point to the diff memory location
s2==s4 will return false as we are checking memory location and not the actual content.So even actual content is same the objects are diff and memory locations are different.
So we have to use s2.equals(s3) to compare contents of two object.
Please note it is always a good idea to use .equals to compare Strings no matter which way they are made as String is a class and here we are making objects and equals is the method to compare objects.
Moreover if String are made using second method(i.e new String("Helloe") then although they are equal but == will return false which is actually not true.
We can even use equalsIgnoreCase to compare to Strings which might have upper lower cases difference.