generated from just-the-docs/just-the-docs-template
-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Question 23
Generics
Given the following family hierarchy and variable declarations, which statements compile without error?
import java.util.*;
class Grandparent {}
class Parent extends Grandparent {}
class Child extends Parent {}
class Family {
List<? super Grandparent> ancestors = null;
List<? extends Child> descendants = null;
}
A.ancestors.add(new Grandparent()); ancestors.add(new Parent()); ancestors.add(new Child());
B.descendants.add(new Child()); descendants.add(new Parent());
C.Grandparent g = ancestors.get(0);
D.Parent p = ancestors.get(0);
E.Child c = descendants.get(0);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels