ArraryList a = new ArrayList(); a.add(“Alpha”); a.add(“Bravo”): a.add(“Charlie”); a.add(“Delta”); Iterator iter = a.iterator(); Which two, added at line 17, print the names in the ArrayList in alphabetical order?()
- A、 for (int i=0; i< a.size(); i++) System.out.println(a.get(i)));
- B、 for (int i=0; i< a.size(); i++) System.out.println(a[i]);
- C、 while( iter.hasNext() ) System.out.println(iter.next()) ;
- D、 for (int i=0, i< a.size(); i++) System.out.println(iter[i]);
- E、 for (int i=0; i< a.size(); i++) System.out.println(iter.get(i));
正确答案:A,C
答案解析:有
微信扫一扫手机做题