String is not a primitive data type like int and double are. Strings are objects.
For Strings, the relational operator, ==, only checks to see if the objects "point" to the same data in the heap.
For example,
String s1="Cat";
String s2= new String("Cat");
if(s1==s2)
System.out.println("They are the same");
The if statement WILL NOT execute.
This is because after you created an instance of "Cat", you create another instance of "Cat," in the heap. The two variables do not "point" to the same data.
compareTo methods check to see if the actual data that the variables are allocated to in a heap are equal to each other, and is one of the many correct ways to see if two String objects are equal to each other.
I hope it helped, if my response is unclear, please do not hesitate to ask.