欢迎来到计算机考试题库网 计算机题库官网
logo
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

Which method will complete this class?()

    A.public int compareTo(Object o){/* more code here */}
    B.public int compareTo(Score other){/* more code here */}
    C.public int compare(Score s1, Score s2){/* more code here */}
    D.public int compare(Object o1, Object o2){/* more code here */}

点击查看答案

相关考题

  • 单项选择题
    Which statement is true?()

    A.The equals method does NOT properly override the Object.equals method.
    B.Compilation fails because the private attribute p.name cannot be accessed in line 5.
    C.To work correctly with hash-based data structures, this class must also implement the hashCode method.
    D.When adding Person objects to a java.util.Set collection, the equals method in line 4 will prevent duplicates.

  • 单项选择题
    Which change can you make to Target without affecting Client?()

    A.Line 4 of class Target can be changed to return i++;
    B.Line 2 of class Target can be changed to private int i = 1;
    C.Line 3 of class Target can be changed to private int addOne(){};
    D.Line 2 of class Target can be changed to private Integer i = 0;

  • 单项选择题
    What is the result?()

    A.0
    B.1
    C.4
    D.Compilation fails.
    E.An exception is thrown at runtime.

微信小程序免费搜题
微信扫一扫,加关注免费搜题

微信扫一扫,加关注免费搜题