I’m having trouble with some of my homework for Java. I just can’t grasp the concept of these generics.
The question is:
Assume the following is a method header in a class:
public <T implements Comparable <T>>T greatest(T arg1, T arg2)
Find the error?
I really don’t understand how to go.
To make that stuff compile you must modify in the following way :
Comparable is an interface but in this context, extends is used to mean either “extends” (for classes) or “implements” (for interfaces).