Example & Tutorial understanding programming in easy ways.

What is the difference between Comparable and Comparator Interface?

The difference between Comparable and Comparator are following:-

                                  Comparable                          Comparator
1 Comparable provides only one sort of sequence. 1 Comparator provides multiple sort of sequences.
2 It provides one method named compareTo(). 2 It provides one method named compare().
3 It is found in java.lang package. 3 It is found in java.util package.
4 If we implement Comparable interface,actual class is modified. 4 Actual class is not modified.

Read More →
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!