way that avoids many explicit casts generic type is type that is not defined at compilation timebut becomes fully specified at run time the generics framework allows us to define class in terms of set of formal type parameterswith could be usedfor exampleto abstract the types of some internal variables of the class angle brackets are used to enclose the list of formal type parameters although any valid identifier can be used for formal type parametersingle-letter uppercase names are conventionally used given class that has been defined with such parameterized typeswe instantiate an object of this class by using actual type parameters to indicate the concrete types to be used in code fragment we show class pair storing key-value pairswhere the types of the key and value are specified by parameters and vrespectively the main method creates two instances of this classone for string-integer pair (for exampleto store dimension and its value)and the other for studentdouble pair (for exampleto store the grade given to studentcode fragment example using the student class from code fragment