February 2014
Beginner
1248 pages
62h 25m
English
Generic method maximum (lines 17–28) uses type parameter T as the return type of the method (line 17), as the type of method parameters x, y and z (line 17), and as the type of local variable max (line 19). The type-parameter section specifies that T extends Comparable<T>—only objects of classes that implement interface Comparable<T> can be used with this method. Comparable<T> is known as the type parameter’s upper bound. By default, Object is the upper bound, meaning that an object of any type can be used. Type-parameter declarations that bound the parameter always use keyword extends regardless of whether the type parameter extends a class or implements an interface. The ...
Read now
Unlock full access