嗨,我得到这个 java 代码的标题错误
public static void age(Ship ob){
DateTime myBirthDate = ob.getDate();
DateTime now = new DateTime();
Period period = new Period(myBirthDate, now);
System.out.print("Ship age is " + ob.getName() + " е " );
PeriodFormatter formatter = new PeriodFormatterBuilder()
.appendYears().appendSuffix(" years")
.appendMonths().appendSuffix(" months")
.appendWeeks().appendSuffix(" weeks")
.appendDays().appendSuffix(" days")
.appendHours().appendSuffix(" hours")
.appendMinutes().appendSuffix(" mnutes")
.appendSeconds().appendSuffix(" seconds\n ")
.printZeroNever().toFormatter();
String elapsed = formatter.print(period);
System.out.println(elapsed);
}
public static void compare(Ship ob, Ship ob2) throws ParseException {
if(age(ob2) > age(ob)){ //<---- I get the Error here , when i try to comapre two objects
System.out.println( "The ship,wich is more years is " + ob2);
} else
System.out.println( "The ship,wich is more years is " + ob);
}
你能帮助我吗?我尝试了很多方法来修复此错误,但没有任何帮助,谢谢。