Generic Types and Methods

Generic types and methods are a new feature of Java 5.0. A generic type is a class or interface that has one or more type variables and one or more methods that use a type variable as a placeholder for an argument or return type.

Using generic types and methods allows you to take advantage of stronger compile-time type checking. When a generic type is used, an actual type is specified for each type variable. This additional type information is used by the compiler to automatically cast the associated return values.


Created October 7, 2009. Send feedback on this help topic to Sybase Technical Publications: pubs@sybase.com