Java Reference
In-Depth Information
a method called
test( )
that accepts as an argument only
Gen
objects whose type parameter
is
A
or a subclass of
A
:
The following class demonstrates the types of
Gen
objects that can be passed to
test( )
.
In
main( )
, objects of type
A
,
B
,
C
, and
D
are created. These are then used to create four
Gen
objects, one for each type. Finally, four calls to
test( )
are made, with the last call com-