September 2011
Beginner
650 pages
15h 47m
English
Beginning with JDK 7, it is possible to shorten the syntax used to create an instance of a generic type. To begin, think back to the TwoGen class shown earlier in this chapter. A portion is shown here for convenience. Notice that it uses two generic types.

For versions of Java prior to JDK 7, to create an instance of TwoGen, you must use a statement similar to the following:
![]()
Here, the type arguments (which are Integer and String) are specified twice: first, when tgOb is declared, and second, when a TwoGen ...
Read now
Unlock full access