🎴 Flashcard Mode
Java Threading and Generics
Card1 / 11
Mastered0
Review0
QuestionClick to flip
What are the benefits of generics?
AnswerClick to flip back
A
Type errors are caught at compile time
B
Generics result in readily understandable code
C
Generics sometimes require type casting
💡 Explanation:
Generics provide compile-time type checking (B), making code more readable and understandable (C). While generics reduce casting, there are scenarios where casting is still needed (D), such as when working with legacy code or raw types. Option A is incorrect because generic collections are designed to accept specific type parameters, not just Object types.