网友您好, 请在下方输入框内输入要搜索的题目:

题目内容 (请给出正确答案)
单选题
11. List list = // more code here  12. Collections.sort(list, new MyComparator());  Which code will sort this list in the opposite order of the sort in line 12?()
A

 Collections.reverseSort(list, new MyComparator());

B

 Collections.sort(list, new MyComparator()); list.reverse();

C

 Collections.sort(list, new InverseComparator( new MyComparator()));

D

 Collections.sort(list, Collections.reverseOrder( new MyComparator()));


参考答案

参考解析
解析: 暂无解析
更多 “单选题11. List list = // more code here  12. Collections.sort(list, new MyComparator());  Which code will sort this list in the opposite order of the sort in line 12?()A  Collections.reverseSort(list, new MyComparator());B  Collections.sort(list, new MyComparator()); list.reverse();C  Collections.sort(list, new InverseComparator( new MyComparator()));D  Collections.sort(list, Collections.reverseOrder( new MyComparator()));” 相关考题
考题 欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?( B ) A.ArrayList myList=new Object();B.List myList=new ArrayList();C.ArrayList myList=new List();D.List myList=new List();

考题 欲构造ArrayList类的一个实例,此类实现List接口,下列方法正确的是______。A.ArrayList myList=new Object( );B.List myList=new ArrayList( );C.ArrayList myList=new List( );D.List myList=new List( );

考题 欲构造ArrayList类的一个实例,此类继承了List接口,下列( )方法是正确的。A.ArrayList myList=new Object();B.List myList=new ArrayList();C.ArrayList myList=new List();D.List myList=new List();

考题 Listlist=//morecodehere12.Collections.sort(list,newMyComparator());Whichcodewillsortthislistintheoppositeorderofthesortinline12?() A.Collections.reverseSort(list,newMyComparator());B.Collections.sort(list,newMyComparator());list.reverse();C.Collections.sort(list,newInverseComparator(newMyComparator()));D.Collections.sort(list,Collections.reverseOrder(newMyComparator()));

考题 Given:Which code, inserted at line 4, guarantees that this program will output [1, 2]()? A.Set set = new TreeSet();B.Set set = new HashSet();C.Set set = new SortedSet();D.List set = new SortedList();E.Set set = new LinkedHashSet();

考题 现有:   3.import java.util.*;   4.class ForInTest {   5.static List list = new ArrayList();  6.public static void main (String [] args){   7.  8.list.add("a"); list.add("b"); list.add("c");   9.//insert code here      10.System.out.print(o);  } }   哪一行插入到第9行将导致输出“abc”?() A、 for(Object o : list)B、 for(Iterator o : list)C、 for(Object o : list.iterator())D、 for(Iterator o : list.iterator(); o.hasNext (); )

考题 11. public void addStrings(List list) {  12. list.add(”foo”);  13. list.add(”bar”);  14. }  What must you change in this method to compile without warnings?() A、 add this code after line 11: list = (List) list;B、 change lines 12 and 13 to: list.add(”foo”); list.add(”bar”);C、 change the method signature on line 11 to: public void addStrings(List extends String list) {D、 change the method signature on line 11 to: public void addStrings(List super String list) {E、 No changes are necessary. This method compiles without warnings.

考题 10. interface A { void x(); }  11. class B implements A { public void x() { } public voidy() { } }  12. class C extends B { public void x() {} }  And:  20. java.util.List list = new java.util.ArrayList();  21. list.add(new B());  22. list.add(new C());  23. for (A a:list) {  24. a.x();  25. a.y();;  26. }  What is the result?()  A、 The code runs with no output.B、 An exception is thrown at runtime.C、 Compilation fails because of an error in line 20.D、 Compilation fails because of an error in line 21.E、 Compilation fails because of an error in line 23.F、 Compilation fails because of an error in line 25.

考题 11. List list = // more code here  12. Collections.sort(list, new MyComparator());  Which code will sort this list in the opposite order of the sort in line 12?() A、 Collections.reverseSort(list, new MyComparator());B、 Collections.sort(list, new MyComparator()); list.reverse();C、 Collections.sort(list, new InverseComparator( new MyComparator()));D、 Collections.sort(list, Collections.reverseOrder( new MyComparator()));

考题 欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?()A、 ArrayList myList=new Object();B、 List myList=new ArrayList();C、 ArrayList myList=new List();D、 List myList=new List();

考题 1. import java.util.*;  2. class ForInTest {  3. static List list = new ArrayList();  4.  5. static List getList() { return list; }  6.  7. public static void main(String [] args) {  8. list.add("a"); list.add("b"); list.add("c");  9. // insert code here  10. System.out.print(o);  11. }  12. } 第 9 行插入哪一项将输出 abc?() A、for(char o: list)B、for(Object o: getList())C、for(Object o: getList();)D、for(Object o: o.getList())

考题 james needs to sort a list of values in a list of values in fieldA, and when the form in saved ,he wants to sort the list before it is saved. Which one of the following formulas would accomplish this?()A、 @sort B、 @sort(@thisvalue) C、 @sortAscending(fieldA)      D、 @sort(“ascesding”;”fieldA”)

考题 现有:  1.  import java.util.*;      2. class ForInTest  {  3.static List list - new ArrayList():      4.  5.static List getList()    {  return list;    }      6.  7.public static void main (Strincj[]  args)    {      8.list.add("a");  list.add("b");  list.add("c");      9.    //insert code here      10.    System.out.print (o);      11.    }      12.  }  第9行插入哪一项将输出abc?()     A、 for(char o: list)B、 for (Object o:  o.getList())C、 for(Object o: getList();)D、 for(Object o: getList())E、 for(Object o: o.getList();)

考题 public static Iterator reverse(List list) {  Collections.reverse(list);  return list.iterator();  }  public static void main(String[] args) {  List list = new ArrayList();  list.add(” 1”); list.add(”2”); list.add(”3”);  for (Object obj: reverse(list))  System.out.print(obj + “,”);  }  What is the result?() A、 3,2,1,B、 1,2,3,C、 Compilation fails.D、 The code runs with no output.E、 An exception is thrown at runtime.

考题 3. import java.util.*;   4. class ForInTest {   5. static List list = new ArrayList();   6.   7. public static void main(String [] args) {   8. list.add("a"); list.add("b"); list.add("c");   9. //insert code here   10. System.out.print(o);   11. }   12. }   哪一行插入到第9行将导致输出“abc”?()  A、 for(Object o : list)B、 for(Iterator o : list)C、 for(Object o : list.iterator())D、 for(Iterator o : list.iterator(); o.hasNext (); )

考题 11. public static void append(List list) { list.add(”0042”); }  12. public static void main(String[] args) {  13. List intList = new ArrayList();  14. append(intList);  15. System.out.println(intList.get(0));  16. }  What is the result?() A、 42B、 0042C、 An exception is thrown at runtime.D、 Compilation fails because of an error in line 13.E、 Compilation fails because of an error in line 14.

考题 单选题11. public static void append(List list) { list.add(”0042”); }  12. public static void main(String[] args) {  13. List intList = new ArrayList();  14. append(intList);  15. System.out.println(intList.get(0));  16. }  What is the result?()A  42B  0042C  An exception is thrown at runtime.D  Compilation fails because of an error in line 13.E  Compilation fails because of an error in line 14.

考题 单选题现有:  1.  import java.util.*;      2. class ForInTest  {  3.static List list - new ArrayList():      4.  5.static List getList()    {  return list;    }      6.  7.public static void main (Strincj[]  args)    {      8.list.add("a");  list.add("b");  list.add("c");      9.    //insert code here      10.    System.out.print (o);      11.    }      12.  }  第9行插入哪一项将输出abc?()A  for(char o: list)B  for (Object o:  o.getList())C  for(Object o: getList();)D  for(Object o: getList())E  for(Object o: o.getList();)

考题 单选题james needs to sort a list of values in a list of values in fieldA, and when the form in saved ,he wants to sort the list before it is saved. Which one of the following formulas would accomplish this?()A  @sort B  @sort(@thisvalue) C  @sortAscending(fieldA)      D  @sort(“ascesding”;”fieldA”)

考题 单选题public static Iterator reverse(List list) {  Collections.reverse(list);  return list.iterator();  }  public static void main(String[] args) {  List list = new ArrayList();  list.add(” 1”); list.add(”2”); list.add(”3”);  for (Object obj: reverse(list))  System.out.print(obj + “,”);  }  What is the result?()A  3,2,1,B  1,2,3,C  Compilation fails.D  The code runs with no output.E  An exception is thrown at runtime.

考题 单选题现有:   3.  import java.util.*;   4.  class ForInTest {   5.    static List list = new ArrayList();   6.   7.    public static void main(String [] args) {   8.      list.add("a"); list.add("b"); list.add("c");   9.      //insert code here      10.     System.out.print(o);    11.   }   12. }   哪一行插入到第9行将导致输出“abc”?()A  for(Object o : list)B  for(Iterator o : list)C  for(Object o : list.iterator())D  for(Iterator o : list.iterator(); o.hasNext (); )

考题 单选题1. import java.util.*;  2. class ForInTest {  3. static List list = new ArrayList();  4.  5. static List getList() { return list; }  6.  7. public static void main(String [] args) {  8. list.add("a"); list.add("b"); list.add("c");  9. // insert code here  10. System.out.print(o);  11. }  12. } 第 9 行插入哪一项将输出 abc?()A for(char o: list)B for(Object o: getList())C for(Object o: getList();)D for(Object o: o.getList())

考题 单选题3. import java.util.*;   4. class ForInTest {   5. static List list = new ArrayList();   6.   7. public static void main(String [] args) {   8. list.add("a"); list.add("b"); list.add("c");   9. //insert code here   10. System.out.print(o);   11. }   12. }   哪一行插入到第9行将导致输出“abc”?()A  for(Object o : list)B  for(Iterator o : list)C  for(Object o : list.iterator())D  for(Iterator o : list.iterator(); o.hasNext (); )

考题 单选题10. interface A { void x(); }  11. class B implements A { public void x() { } public voidy() { } }  12. class C extends B { public void x() {} }  And:  20. java.util.List list = new java.util.ArrayList();  21. list.add(new B());  22. list.add(new C());  23. for (A a:list) {  24. a.x();  25. a.y();;  26. }  What is the result?()A  The code runs with no output.B  An exception is thrown at runtime.C  Compilation fails because of an error in line 20.D  Compilation fails because of an error in line 21.E  Compilation fails because of an error in line 23.F  Compilation fails because of an error in line 25.

考题 单选题欲构造ArrayList类的一个实例,此类继承了List接口,下列哪个方法是正确的?()A  ArrayList myList=new Object();B  List myList=new ArrayList();C  ArrayList myList=new List();D  List myList=new List();

考题 单选题11. public void addStrings(List list) {  12. list.add(”foo”);  13. list.add(”bar”);  14. }  What must you change in this method to compile without warnings?()A  add this code after line 11: list = (List) list;B  change lines 12 and 13 to: list.add(”foo”); list.add(”bar”);C  change the method signature on line 11 to: public void addStrings(List extends String list) {D  change the method signature on line 11 to: public void addStrings(List super String list) {E  No changes are necessary. This method compiles without warnings.

考题 单选题现有:   3.import java.util.*;   4.class ForInTest {   5.static List list = new ArrayList();  6.public static void main (String [] args){   7.  8.list.add("a"); list.add("b"); list.add("c");   9.//insert code here      10.System.out.print(o);  } }   哪一行插入到第9行将导致输出“abc”?()A  for(Object o : list)B  for(Iterator o : list)C  for(Object o : list.iterator())D  for(Iterator o : list.iterator(); o.hasNext (); )

考题 单选题11. List list = // more code here  12. Collections.sort(list, new MyComparator());  Which code will sort this list in the opposite order of the sort in line 12?()A  Collections.reverseSort(list, new MyComparator());B  Collections.sort(list, new MyComparator()); list.reverse();C  Collections.sort(list, new InverseComparator( new MyComparator()));D  Collections.sort(list, Collections.reverseOrder( new MyComparator()));