previous | start | next

Syntax 22.2: Defining a Generic Class

accessSpecifier class GenericClassName<TypeVariable1, TypeVariable2, . . .>
{
constructors
methods
fields

}

Example:

 
public class Pair<T, S>
{
. . .
}

Purpose:

To define a generic class with methods and fields that depend on type variables


previous | start | next