A.Objectx=t.findLarger(123,“456”);
B.intx=t.findLarger(123,newDouble(456));
C.intx=t.findLarger(123,newInteger(456));
D.intx=(int)t.findLarger(newDouble(123),newDouble(456));
第1题
publicclassDrinkimplementsComparable{publicStringname;publicintcompareTo(Objecto){return0;}}and:Drinkone=newDrink();Drinktwo=newDrink();one.name=Coffee”;two.name=Tea”;TreeSetset=newTreeSet();set.add(one);set.add(two);AprogrammeriteratesovertheTreeSetandprintsthenameofeachDrinkobject.Whatistheresult?()
A.Tea
B.Coffee
C.CoffeeTea
D.Compilationfails.
E.Thecoderunswithnooutput.
F.Anexceptionisthrownatruntime.
第2题
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()));
第3题
A.ListmyList=myArray.asList();
B.ListmyList=Arrays.asList(myArray);
C.ListmyList=newArrayList(myArray);
D.ListmyList=Collections.fromArray(myArray);
第4题
publicstaticvoidsearch(Listlist){list.clear();list.add(”b”);list.add(”a”);list.add(”c”);System.out.println(Collections.binarySearch(list,a”));}WhatistheresultofcallingsearchwithavalidListimplementation?()
A.0
B.1
C.a
D.b
E.c
F.Theresultisundefined.
为了保护您的账号安全,请在“上学吧”公众号进行验证,点击“官网服务”-“账号验证”后输入验证码“”完成验证,验证成功后方可继续查看答案!