Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo()method, which two statements are true?()A.The class implements java.lang.Comparable.B.The class implements java.util.Comparator.C.The interface used t

题目
Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo()method, which two statements are true?()

A.The class implements java.lang.Comparable.

B.The class implements java.util.Comparator.

C.The interface used to implement sorting allows this class to define only one sort sequence.

D.The interface used to implement sorting allows this class to define many different sort sequences.


相似考题
更多“Given a class whose instances, when found in a collection of objects, are sorted by using the compareTo()method, which two statements are true?() ”相关问题
  • 第1题:

    下列CASE语句中执行结果不为空的是()

    A、SELECTCASEWHEN125THEN'true'ELSE'false'END;

    B、SELECTCASEBINARY'B'WHEN'a'THEN1WHEN'b'THEN2END;

    C、SELECTCASEWHEN-10THEN'true'END;

    D、SELECTCASE'one'WHEN1THEN'one'WHEN2THEN'two'END;


    正确答案:A

  • 第2题:

    [A] who [B] when [C] where [D] which


    正确答案:C

  • 第3题:

    Java的容器中重要的接口java.util.Collection定义了许多方法。下面的选项中哪个方法不是Collection接口所定义的?()

    A.int size()

    B.boolean containsAll(Collection c)

    C.compareTo(Object obj)

    D.boolean remove(Object obj)


    compareTo(Object obj)

  • 第4题:

    [A] which [B] that [C] what [D] when


    正确答案:A
     此题属于语法题。which引导定语从句,修饰the way,in which往往可以省略,例如:the way he treated his wife=the way in which he treated his wife。其他选项均不符合题意。

  • 第5题:

    The beautiful mountain village__________ we spent our holiday last year is locatedin __________ is now part of Guangxi.

    A.which ; where
    B.where; what
    C.that ; what
    D.when ; which

    答案:B
    解析:
    where在此充当地点状语,what既充当located in的宾语又充当is的主语,本题考查定语从句和名词性从句。mountain village在定语从句we spent our holiday last year作地点状语,故用关系副词where:第二个考查宾语从句,从句中缺少主语,故用what作主语。故选B。

  • 第6题:

    2、Java的集合框架中重要的接口java.util.Collection定义了许多方法。下列不是Collection接口所定义的的方法是()。

    A.int size()

    B.boolean containsAll(Collection c)

    C.compareTo(Object obj)

    D.boolean remove(Object obj)


    Java 集合类提供了一套设计良好的支持对一组对象进行操作的接口和类。Java集合类里面最基本的接口有: Collection:代表一组对象,每一个对象都是它的子元素。 Set:不包含重复元素的 Collection。 List:有顺序的 collection,并且可以包含重复元素。 Map:可以把键(key)映射到值(value)的对象,键不能重复。