Comparable interface in java
Let’s learn comparable interface in java. Comparable interface in java Comparable interface is present in java.lang package and it contains only one method compareTo(). Declaration: public interface Comparable<T> Parameters: <T> the type of objects that this object may be compared to. compareTo(Object obj) method Declaration: public int compareTo(Object obj) Parameters: obj the object to be…
Read More Comparable interface in java