Mastering Java 2025 – 400 Free Practice Questions to Pass the 'Thinking in Java' Exam

Image Description

Question: 1 / 510

In what way are generics limited in Java?

Generics do not support primitive data types as type parameters

Generics are limited in Java because they do not support primitive data types as type parameters. This means that only objects can be used as type parameters in generics. In contrast, primitive types (such as int, double, boolean) cannot be used, which can be a limitation when dealing with data types that are not objects. Options B, C, and D are incorrect because they do not accurately describe the limitations of generics in Java. Option B is incorrect because generics can be used beyond just collection classes. Option C is incorrect because generics can use wildcard types, which are used to represent unknown types. And finally, option D is also incorrect as there is no restriction on the superclass of the objects used in generics, they just need to be objects.

Get further explanation with Examzify DeepDiveBeta

Generics can only be used with collection classes

Generics cannot use wildcard types

Generics can only operate on objects that inherit from a specific superclass

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy