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

题目内容 (请给出正确答案)
单选题
Given:  ArrayList a = new ArrayList();  containing the values {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”} Which code will return 2?()
A

 Collections. sort(a, a.reverse()); int result = Collections.binarySearch(a, “6”);

B

 Comparator c = Collections.reverseOrder(); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”);

C

 Comparator c = Collections.reverseOrder(); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”,c);

D

 Comparator c = Collections.reverseOrder(a); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”,c);

E

 Comparator c = new InverseComparator(new Comparator()); Collections.sort(a); int result = Collections.binarySearch(a, “6”,c);


参考答案

参考解析
解析: 暂无解析
更多 “单选题Given:  ArrayList a = new ArrayList();  containing the values {“1”, “2”, “3”, “4”, “5”, “6”, “7”, “8”} Which code will return 2?()A  Collections. sort(a, a.reverse()); int result = Collections.binarySearch(a, “6”);B  Comparator c = Collections.reverseOrder(); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”);C  Comparator c = Collections.reverseOrder(); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”,c);D  Comparator c = Collections.reverseOrder(a); Collections.sort(a, c); int result = Collections.binarySearch(a, “6”,c);E  Comparator c = new InverseComparator(new Comparator()); Collections.sort(a); int result = Collections.binarySearch(a, “6”,c);” 相关考题
考题 欲构造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();

考题 下列数组a中,版本较新的能在程序运行时动态调整大小的是A.int a[]B.String []aC.a=new ArrayList()D.a=new Array()

考题 YouarewritingaJSPthatincludesscriptletcodetodeclareaListvariableandinitializesthatvariabletoanArrayListobject.WhichtwoJSPcodesnippetscanyouusetoimporttheselisttypes?() A.%!importjava.util.*;%B.%!importjava.util.List;importjava.util.ArrayList;%C.%@pageimport=’java.util.List’import=’java.util.ArrayList’%D.%@importtypes=’java.util.List’types=’java.util.ArrayList’%E.%@pageimport=’java.util.List,java.util.ArrayList’%F.%@importtypes=’java.util.List,java.util.ArrayList’%

考题 11.public void genNumbers(){12.ArrayList numbers=new ArrayList();13.for(inti=0;i14.intvalue=i*((int)Math.random());15.IntegerintObj=newInteger(value);16.numbers.add(intObj);17.}18.System.out.println(numbers);19.}Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()A.Line16B.Line17C.Line18D.Line19E.The object is NOT a candidate for garbage collection.

考题 下列数组array_test中,能在程序运行时动态调整大小的是A.int array_test []=new int[10]B.String[] array_testC.ArrayList array_test=new ArrayList()D.Array array_test=new Array()

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

考题 Given:  int[] myArray=newint[] {1, 2,3,4, 5};  What allows you to create a list from this array?() A、 List myList = myArray.asList();B、 List myList = Arrays.asList(myArray);C、 List myList = new ArrayList(myArray);D、 List myList = Collections.fromArray(myArray);

考题 11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 13.for(inti=0;i10;i++){ 14.intvalue=i*((int)Math.random()); 15.IntegerintObj=newInteger(value); 16.numbers.add(intObj); 17.} 18.System.out.println(numbers); 19.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()A、Line16B、Line17C、Line18D、Line19E、The object is NOT a candidate for garbage collection.

考题 Vector和ArrayList的主要区别是()A、ArrayList内部基于链表,而Vector是基于数组的B、Vector的大部分方法做了同步,而ArrayList没有同步C、Vector是可串行化的,而ArrayList不是D、Vector实现了RandomAccess,而ArrayList没有

考题 You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object. Which two JSP code snippets can you use to import these list types?()A、%! import java.util.*; %B、%! import java.util.List;import java.util.ArrayList; %C、%@ page import=’java.util.List’import=’java.util.ArrayList’ %D、%@ import types=’java.util.List’types=’java.util.ArrayList’ %E、%@ page import=’java.util.List,java.util.ArrayList’ %F、%@ import types=’java.util.List,java.util.ArrayList’ %

考题 Vector 与 ArrayList正确的是:()A、 ArrayList 出现比Vector早B、 ArrayList 速度比Vector慢C、 ArrayList 没有同步保护,Vector具有同步保护D、 ArrayList Vector 两者都是无序的集合"

考题 创建一个ArrayList集合实例,该集合中只能存放String类型数据,下列()代码是正确的A、ArrayList myList=new ArrayList()B、ArrayListStringmyList=new ArrayList;()C、ArrayListmyList=new ArrayListString()D、ArrayListmyList=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和Vector的区别。

考题 现有:  1. import java.util.*;      2.  3. Class FindStuff  {  4.public static void main (String[]args)    {      5,    //insert code here      6.    c.put ("X", 123);      7.    }      8.  } 分别插入到第5行,哪三行允许代码编译?()    A、 Map c= new SortedMap();B、 HashMap c= new HashMap();C、 HashMap c= new Hashtalole();D、 SortedMap c= new TreeMap();E、 ArrayList c= new ArrayList();F、  MaD c = new LinkedHashMap();

考题 单选题11. public void genNumbers() {  12. ArrayList numbers = new ArrayList();  13. for (int i=0; i10; i++) {  14. int value = i * ((int) Math.random());  15. Integer intObj = new Integer(value);  16. numbers.add(intObj);  17. }  18. System.out.println(numbers);  19. }  Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbage collection?()A  Line 16B  Line 17C  Line 18D  Line 19E  The object is NOT a candidate for garbage collection.

考题 单选题创建一个ArrayList集合实例,该集合中只能存放String类型数据,下列()代码是正确的A ArrayList myList=new ArrayList()B ArrayListStringmyList=new ArrayList;()C ArrayListmyList=new ArrayListString()D ArrayListmyList=new List()

考题 单选题Given:  int[] myArray=newint[] {1, 2,3,4, 5};  What allows you to create a list from this array?()A  List myList = myArray.asList();B  List myList = Arrays.asList(myArray);C  List myList = new ArrayList(myArray);D  List myList = Collections.fromArray(myArray);

考题 单选题Given:   11. public void genNumbers() {   12. ArrayList numbers = new ArrayList();   13. for (int i=0; i10; i++) { 14. int value = i * ((int) Math.random());   15. Integer intObj = new Integer(value);   16. numbers.add(intObj);   17. }   18. System.out.println(numbers);   19. }   Which line of code marks the earliest point that an object referenced by intObj becomes a  candidate for garbage collection?()A  Line 19B  The object is NOT a candidate for garbage collection.C  Line 17D  Line 16E  Line 18

考题 单选题1. import java.util.*;  2. class SubGen {  3. public static void main(String [] args) {  4. //insert code here  5. }  6. }  class Alpha { }  class Beta extends Alpha { }  class Gamma extends Beta { }  和四段代码片段:  s1. ArrayList〈? extends Alpha〉 list1 = new ArrayList〈Gamma〉();  s2. ArrayList〈Alpha〉 list2 = new ArrayList〈? extends Alpha〉();  s3. ArrayList〈? extends Alpha〉 list3 = new ArrayList〈? extends Beta〉();  s4. ArrayList〈? extends Beta〉 list4 = new ArrayList〈Gamma〉(); ArrayList〈? extends Alpha〉 list5 = list4;  哪些片段分别插入到第4行,可允许代码编译?()A 只有s1B 只有s3C 只有s1和s3D 只有s1和s4

考题 多选题You are writing a JSP that includes scriptlet code to declare a List variable and initializes that variable to anArrayList object. Which two JSP code snippets can you use to import these list types?()A%! import java.util.*; %B%! import java.util.List;import java.util.ArrayList; %C%@ page import=’java.util.List’import=’java.util.ArrayList’ %D%@ import types=’java.util.List’types=’java.util.ArrayList’ %E%@ page import=’java.util.List,java.util.ArrayList’ %F%@ import types=’java.util.List,java.util.ArrayList’ %

考题 单选题Vector和ArrayList的主要区别是()A ArrayList内部基于链表,而Vector是基于数组的B Vector的大部分方法做了同步,而ArrayList没有同步C Vector是可串行化的,而ArrayList不是D Vector实现了RandomAccess,而ArrayList没有

考题 单选题11.public void genNumbers(){ 12.ArrayList numbers=new ArrayList(); 13.for(inti=0;i10;i++){ 14.intvalue=i*((int)Math.random()); 15.IntegerintObj=newInteger(value); 16.numbers.add(intObj); 17.} 18.System.out.println(numbers); 19.} Which line of code marks the earliest point that an object referenced by intObj becomes a candidate for garbagec ollection?()A Line16B Line17C Line18D Line19E The object is NOT a candidate for garbage collection.

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

考题 单选题Vector 与 ArrayList正确的是:()A  ArrayList 出现比Vector早B  ArrayList 速度比Vector慢C  ArrayList 没有同步保护,Vector具有同步保护D  ArrayList Vector 两者都是无序的集合