September 2011
Beginner
650 pages
15h 47m
English
Wildcard arguments can be bounded in much the same way that a type parameter can be bounded. A bounded wildcard is especially important when you are creating a method that is designed to operate only on objects that are subclasses of a specific superclass. To understand why, let’s work through a simple example. Consider the following set of classes:

Here, class A is extended by classes B and C, but not by D.
Next, consider the following very simple generic class:

Gen takes one type parameter, which specifies the type of object ...
Read now
Unlock full access