Ctrl K
Java · Senior · Theory

Tell me about type erasure in Java generics. What limitations does it impose, and how do you use wildcard types when designing an API?

~4 min by voice

How to approach it

This checks whether the candidate understands how generics actually work in the JVM (erasure, casts, consequences), and whether they can deliberately design flexible APIs with wildcards following PECS, rather than adding "a question mark when the compiler complains."

Have you seen this question in a real interview?
Answers0
Avg. score—
Strong—
Practiced0
Topics
Similar questionsWhy does Java have generics, and what is type erasure? JuniorWhy can't you write new T() or check instanceof List<String> in Java? And how do you choose between List<? extends Number> and List<? super Integer>? Mid-level

Answer by voice

The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.

Sign in to answer

Best with headphones · ~4 min