未对参数类型java.lang.String,java.lang.String定义运算符>
publicclassHumanbeingimplementsComparable{staticString[]birthArray=newString[3];Strin...
public class Humanbeing implements Comparable{
static String [] birthArray=new String[3];
String age =birthArray[0];
private String birth;
public int compareTo(Object obj){
if(!(obj instanceof Humanbeing)) return 1;
Humanbeing s=(Humanbeing)obj;
if(this.getbirth()>s.getbirth()) return 1;
if(this.getbirth()<s.getbirth()) return -1;
return 0;
}
public String getbirth() {
return birth;
}
.......
应该怎么更改? 展开
static String [] birthArray=new String[3];
String age =birthArray[0];
private String birth;
public int compareTo(Object obj){
if(!(obj instanceof Humanbeing)) return 1;
Humanbeing s=(Humanbeing)obj;
if(this.getbirth()>s.getbirth()) return 1;
if(this.getbirth()<s.getbirth()) return -1;
return 0;
}
public String getbirth() {
return birth;
}
.......
应该怎么更改? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询