A) equals method
The equals method compares the contents, not the reference.
s1.equals(s2); returns true if s1 and s2 contain the same contents.
B.T.W, s1 and s2 must be the same class type, or it returns false.
B) == it compares the reference
s1 == s2 iif s1 and s2 point to the same object.
However;
s1="Java";
s2="Java";
s1 == s2 returns true
c) compareTo method can be used to compare the contents as well.
It returns either negative, 0 when they equal), or positive.