Advertisement

Comparable use in java application

Comparable use in java application 1. why Comparable is required to know as java developer ?
2. what is comparable ? in which package use this Comparable interface ?
3. Real time use in java project example
Ans:-
comparable interface persent in java.lang.package.
sort the elements according to natural sorting order.
It contains only one method .. compareTo(Object object)
compareTo() method is responsible to sort the elements.


Real time use in java project example in interview:
1. you have thousand employee so you will sort that employee through Id.
2 .you have five hundred country name and rank .
how will you sort country as rank order for passport java Applications .
join session in practical .

application

Post a Comment

0 Comments