Chapter: Java The Complete Reference - The Java Language - Generics

| Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail |

The General Form of a Generic Class

The generics syntax shown in the preceding examples can be generalized. Here is the syntax for declaring a generic class:

The General Form of a Generic Class

 

The generics syntax shown in the preceding examples can be generalized. Here is the syntax for declaring a generic class:

 

class class-name<type-param-list > { // …

 

Here is the full syntax for declaring a reference to a generic class and instance creation:

 

class-name<type-arg-list > var-name =

 

new class-name<type-arg-list >(cons-arg-list);


Study Material, Lecturing Notes, Assignment, Reference, Wiki description explanation, brief detail


Copyright © 2018-2020 BrainKart.com; All Rights Reserved. Developed by Therithal info, Chennai.