单项选择题

Given the proper import(s), and given:
4. public static void main(String[] args) {
5. List<Integer> x = new ArrayList<Integer>();
6. x.add(new Integer(3));
7. doStuff (x);
8. for(Integer i: x)
9. System.out.print (i + " ");
10. }
11. static void doStuff(List y) {
12. y.add(new Integer(4));
13. y.add(new Float(3.14f));
14. }
What is the result (Choose all that apply.)

A.Compilation fails.
B.The output will be "4 "
C.The output will be "3 4"
D.The output will be "3 4 3.14"
E.The output will be "3 3.14 4 "
F.The output will be "3 4 ", followed by an exception.
G.An exception will be thrown before any output is produced.
题目列表

你可能感兴趣的试题

微信扫码免费搜题