欢迎来到易学考试网 易学考试官网
全部科目 > Java认证考试 > SCJP程序员认证考试

单项选择题

public class Score implements Comparable { 
private int wins, losses; 
public Score(int w, int 1) { wins = w; losses = 1; } 
public int getWins() { return wins; } 
public int getLosses() { return losses; } 
public String toString() { 
return “<“ + wins + “,“ + losses + “>”;
} 
// insert code here 
} 
Which method will complete this class?() 

    A. public int compareTo(Object o) {/*mode 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*/}

点击查看答案&解析

相关考题

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

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