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 / rajesh

Comparable interface uses Object's compareTo() to compare
the objects. We have to override the compareTo() method in
order to sort.

Where as Comparator, checks for compare() method. You can
sort based on particular property of the object.

Is This Answer Correct ?    4 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are local variables?

1091


Difference between start() and run() method of thread class?

1111


which pattern is default in scanner package?

2265


What is static synchronization?

1155


How do you declare an array that will hold more than 64KB of data?

1377


Is arraylist sorted in java?

1055


How we can execute any code even before main method?

1185


Explain what pure virtual function is?

1062


What are the different tags provided in jstl?

995


Name few "optional" classes introduced with java 8 ?

1180


What are different types of multitasking?

1003


Can we overload the constructors?

1037


What are the 6 functions?

1019


What does jenkins do?

963


Are variables stored in ram?

1062