Collections and Generics
© examsnet.com
Question : 23
Total: 53
Given:
Place the Compilation Results on each code statement to indicate whether or not that code will compile if inserted into the takeList() method.
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: