Test Index
Collections and Generics
© examsnet.com
Question : 23 of 53
Marks:
+1,
-0
Given:
public void takeList (List < ? extends String > list) { /* insert code here */}Place the Compilation Results on each code statement to indicate whether or not that code will compile if inserted into the takeList() method.| Code Statements | Compilation Results |
|---|---|
a. list. add ("Foo"); | (i) Compilation succeeds |
b. list = new ArrayList < String > (); | (ii) Compilation fails |
c. list = new ArrayList < Object > (); | |
d. String s = list.get(0); | |
e. Object o = list; |
Go to Question: