Collections and Generics
© examsnet.com
Question : 24
Total: 53
Place the correct description of the compiler output on the code fragments to be 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 |
|---|---|
a. ArrayList < String > x1 | (i) Compilation succeeds |
b. ArrayList < Object > x2 | (ii) Compilation fails due to an error in the first statement |
c. ArrayList < Object > x3 | (iii) Compilation of the first statement succeeds but compilation fails due to an error in the second statement |
d. ArrayList x4 |
Go to Question: