Collections and Generics
© examsiri.com
Question : 10 of 53
Marks:
+1,
-0
Place the correct description of the compiler output on the code fragments to be inserted at lines 4 and 5 The same compiler output may be used more than once
1. import java.util.*;
2. public class X {
3. public static void main(String[] args) {
4 . /* insert, code here*/
5. /* insert code here */
6. }
7. public static void foo(List < Object > list) {
8. }
}
| Code | Compiler Output |
|---|---|
1 . ArrayList < Strinq > x1 | A) Compilation Succeeds |
2. ArrayList < Object > x2 | B) Compilation fails due to an error in the first statement. |
3. ArrayList < Object > x3 | C) Compilation of the first statement succeeds. but compilation fails due to an error in the second statement; |
4. ArrayList x4 = new ArrayList ( ); |
Go to Question: