Generics In Java - Study Mode

[#1] What is the main purpose of generics in Java?
Correct Answer

(A) To enable type-safe collections and eliminate type casting

[#2] Which symbol is used to denote a generic type parameter in Java?
Correct Answer

(D) ` `

[#3] In a generic class, what does the wildcard ` ` represent?
Correct Answer

(C) An unknown type

[#4] What is the benefit of using generics with collections in Java?
Correct Answer

(B) It ensures type safety by allowing only specific types of elements

[#5] What does the `E` represent in generic class declarations in Java?
Correct Answer

(C) Element type