Which of these is an correct way of defining generic class?
A. class name(T1, T2, …, Tn) { /* … */ }
B. class name { /* … */ }
C. class name[T1, T2, …, Tn] { /* … */ }
D. class name{T1, T2, …, Tn} { /* … */ }
Answer:A
Which of these is an correct way of defining generic class?
A. class name(T1, T2, …, Tn) { /* … */ } B. class name { /* … */ } C. class name[T1, T2, …, Tn] { /* … */ } D. class name{T1, T2, …, Tn} { /* … */ }
Explanation: 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.