Home » JAVA Programming » Generics » Question
  1. Which of these is an correct way of defining generic class?
    1. class name[T1, T2, …, Tn] { /* … */ }
    2. class name(T1, T2, …, Tn) { /* … */ }
    3. class name{T1, T2, …, Tn} { /* … */ }
    4. class name { /* … */ }
    5. None of these
Correct Option: D

The type parameter section, delimited by angle brackets (<>), follows the class name. It specifies the type parameters (also called type variables) T1, T2, …, and Tn.



Your comments will be displayed only after manual approval.