I dont really understand how are we using extends here, do we want to say that T inherits from comparable??
why are we using extend and not implements here too?
T extends Comparable ? timestamp 27:30
Is T an interface or an object?
T denotes a generic data class. It is neither an interface nor an object. It is a placeholder for other classes that can be specified later while running the program.
T extends comparable here means that whatever comes here in place of T should have the Comparable as a parent, like Car in the video
But Comparable is an interface and T is a class ,
A class implements an interface and not extends it ,
Shouldnt it be implement??
No T is not a class. Its a generic class. It can extend comparable
But a class cannot extend an interface
It “implements” it
right?
generic classes are an exception to the rule since it is technically an interface only, it is just called a class due to convention (it works as a placeholder hence is never implemented itself)