Mastering Java: The Ultimate 2026 All-In-One Quiz to Excel in 'Thinking in Java

Question: 1 / 510

What is the difference between List<Apple> and List<? extends Fruit>?

List<Apple> can contain any type of Fruit

List<? extends Fruit> specifies a List of any type that extends Fruit

List<Apple> specifies a List that can only contain Apple objects, while List<? extends Fruit> specifies a List that can contain any type of Fruit (including Apple). Option A is incorrect because List<Apple> can only contain Apple objects, not any type of Fruit. Option C is incorrect because List<Apple> and List<? extends Fruit> have different specifications. Option D is incorrect because there is a clear distinction between List<Apple> and List<? extends Fruit> in terms of which types of objects they can contain.

Get further explanation with Examzify DeepDiveBeta

List<Apple> and List<? extends Fruit> are the same

There is no difference, it's a matter of syntax

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy