Hierarchy and Classification of Genrices

A type variable is an unqualified or complete identifier. Generic class, interface, method and constructor declarations introduce Type variables.

  • A class will be generic when it declares one or more type variables. In this scenario, Type variables are known as the type parameters of the class. It defines one or more type variables that act as parameters. A generic class declaration can define a set of parameterized types, one for each possible invocation of the type parameter section. All of these parameterized types share the same class at runtime.
  • An interface will be generic when it declares one or more type variables. And these type variables are identified as the type parameters of the interface. It describes one or more type variables that act as parameters. A generic interface declaration can define a set of types, one for each possible request of the type parameter section. All parameterized types share the same interface at runtime.
  • A method will be generic when it declares one or more type variables. And these type variables are identified as the formal type parameters of the method. The procedure of the official type parameter list is identical to a type parameter list of a class or interface.
  • A constructor can be declared as generic too, self-reliantly of whether the class that the constructor is acknowledged in is itself generic. A constructor will be generic when it declares one or more type variables. These type variables are identified as the formal type parameters of the constructor. The form of the proper type parameter list is identical to a type parameter list of a generic interface or class.

1 thought on “Hierarchy and Classification of Genrices

Leave a Reply