I found this code in JAVA DOCS
public interface Comparable<T> {
public int compareTo(T o);
}
Which is Comparable Interface!
And
<public static <T extends Comparable<T>> int countGreaterThan(T[] anArray, T elem) {
int count = 0;
for (T e : anArray)
if (e.compareTo(elem) > 0)
++count;
return count;
}
What I have tried:
There is line of code like this
e.compareTo(elem) > 0
e is implements Comparable
but how e can use compareTo method without implements it?