CompareTo() method is derived from Comparable interface and is used to find the Ordering of Strings.
equals() method is from java.lang.Object and used for comparing objects.
Login to rate this answer.
Bharat
Answered On : Oct 1st, 2012
CompareTo method which is present in the String class is used to check the two strings. It checks each character with the other String and if found equals then returns 0. Else negative value or positive value based on which character is higher.
Equals method is used to check the values of the two string are equal then it returns true else false.
Login to rate this answer.