CustomList as the first parameter may be used regardless of the second one.*/ Mapper<CustomList, ?> mapper; mapper = new Mapper<CustomList, Boolean>(); mapper = new Mapper<CustomList, Integer>(); /* Will not accept types that use anything but a subclass of Number as the second parameter */ void addMapper(Mapper<?, ? extends Number> mapper) { } Generic methods and constructors Usage of generics may be limited to some particular methods, this concept applies to constructors as well. To declare a parameterized method, type variables are written before the return type of the method in the same format as for the generic classes. In the case of constructor, type variables are declared before the constructor name. class Mapper { // The class itself is not generic, the constructor is <T, V> Mapper(T array, V item) { } } /* This method will accept only arrays of the same type as the searched item type or its subtype*/ static <T, V extends T> boolean contains(T item, V[] arr) { for (T currentItem : arr) { if (item.equals(currentItem)) { return true; } } return false; } Generic interfaces Interfaces can be parameterized in the similar manner as the classes. interface Expandable<T extends Number> { void addItem(T item); } // This class is parameterized class Array<T extends Number> implements Expandable<T> { void addItem(T item) { } } // And this is not and uses an explicit type instead class IntegerArray implements Expandable<Integer> { void addItem(Integer item) { } } See also Java Platform, Standard Edition References Patrick Naughton, Herbert Schildt. Java 2: The Complete Reference, third edition. The McGraw-Hill Companies, 1999. External links The Java Language Specification, Third edition Authoritative description of the Java language Programming language syntax Java (programming language)