Multiple choice technology programming languages

Given: classA {} class B extends A {} class C extends A {} class D extends B {} Which three statements are true? (Choose three.)

  1. The type List is assignable to List<A>.

  2. The type List<Object> is assignable to List<?>.

  3. The type List<D> is assignable to List<? extends B>.

  4. The type List<? extends B> is assignable to List<? extends A>.

  5. The type List<Object> is assignable to any List reference.

Reveal answer Fill a bubble to check yourself
B,C,D Correct answer
Explanation

In Java generics, List can be assigned to List> because the unbounded wildcard accepts any type. List can be assigned to List extends B> because D extends B. List extends B> can be assigned to List extends A> because B extends A. Option A is false because generics are invariant - List is not assignable to List. Option E is false because List cannot be assigned to List due to invariance.