ExamVeda
Login
Home
This question belongs to Java Program Generics In Java
Generics in Java
?

Which of the following cannot be Type parameterized?

Answer & Solution
Correct Answer: Option C
Generics in Java are tied to the type of objects, meaning they work at the instance level.

Static methods belong to the class itself and are shared across all instances.

Since generics are resolved at the object level, type parameters cannot be directly used within static methods.

Why the other options are incorrect:

Option A: Overloaded Methods
Overloaded methods can have different generic type parameters.
The compiler can differentiate them based on their method signatures, making generic type parameters valid for overloaded methods.

Option B: Generic methods
Generic methods explicitly use type parameters, and this is a common and valid usage of generics in Java.

Option D: Overriding methods
Methods with generic type parameters can be overridden.
The overridden method must respect the same type parameter or use a wildcard (?).
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Diya Shah
Diya Shah 2 years ago
The answer should be overriding methods beacuse the overriding method must have the exact same signature (name, parameters, and return type) as the method in the superclass. So, it cannot introduce new type parameters.