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 */}
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 */}
举一反三
- 智慧职教: 选项中哪一行代码可以替换题目中//add code here而不产生编译错误?()public abstract class MyClass { public int constInt = 5; //add code here public void method() { } }
- 在下列代码中,有( )处实现了拆箱。 int score=5; object o= score; o=10; score =(int)o; object oScore = score;
- 选项中哪一行代码可以替换题目中//add code here而不产生编译错误?() A: public abstract void method(int a); B: constInt = constInt + 5; C: public int method(); D: public abstract void anotherMethod() {}
- class Person{} class Student extends Person{ public int id; public int score; public String name; public int getScore() { return score; }
- 下面哪个方法不是Object类中定义的方法?( ) A: public boolean equals(Object obj) B: public int compareTo() C: public String toString() D: public int hashCode()