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

Can we have static methods in an interface?

1000


What is r in java?

997


What is Java Shutdown Hook?

1115


Can you achieve runtime polymorphism by data members?

1074


What is string data?

941


What is a method vs function?

979


What are the loops in java?

948


Can It is possible to synchronize the constructor of a Java Class?

1032


Which is better ascii or unicode?

938


Can a static method be overridden in java?

966


Difference between default and protected access specifiers?

1028


How do you execute a thread in java?

903


What is string value?

1088


What is meant by data hiding/encapsulation?

1044


What is %d in printf?

994