I tried commenting on the thread below itself, but I do not have enough rep points for it.
My simple question is: what is difference between the following two codes?
Please note: I am not sure if the former is even valid syntax, and maybe that's the answer.
public class BinarySearchTree<T> extends Comparable<T> {}
public class BinarySearchTree<T extends Comparable<T>> {}
class BinarySearchTree<T> implements Comparable<T> {}is arguably strictly incorrect, and would break methods likeArrays.sort. Instances ofComparableare generally expected to be compared to other instances of the same type (i.e. aStringcompares with otherStrings). (Also,extends Comparableis a compilation error.)