GeekInterview.com
Submitted Questions

Compareto and equals method

Asked By: cspatel | Asked On: Jul 3rd, 2012

Difference between compareto and equals method.

Answered by: Bharat 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 positi...

Answered by: Sandhya.Kishan on: Jul 13th, 2012

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.

Interview Question

 Ask Interview Question?

 

Career Counselling

 Have Career Question?

 Ask Chandra

 Ask Only Career questions.

Follow us: