Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Diff between Comparator and Comparable?

Answer Posted / qim2010

The “Comparable” interface allows itself to compare with
another similar object (i.e. A class that implements Comparable
becomes an object to be compared with). The following method
are specified in the interface.

public int compareTo(Object o)
public int compareToIgnoreCase(String str)

The "Comparator" interface is used to compare two different
objects. The following method is specified in the Comparator
interface.

public int compare(Object o1, Object o2)

Is This Answer Correct ?    8 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is a string immutable?

947


Explain about version control?

991


Is void a data type in java?

932


How do you check if two given string are anagrams?

916


What is void class in java?

923


What is nested interface?

967


How is java hashmap implemented?

981


Why is a constant variable important?

900


What is a finally block?

935


What is the major difference between linkedlist and arraylist?

980


How dead lock situation occurs in java and how you can identify it?

947


Which method cannot be overridden in java?

958


Can we call a non-static method from inside a static method?

963


What is a prefix function.write down a code to compute prefix function.

1012


What is the use of jtable?

1074