我想在每次设置提前分钟时获取时间值,如果分钟为六十,则必须自动添加一小时,然后分钟为零。这是我在课堂上的代码。
public class time {
private int hours;
private int minutes;
private String amPm;
public time() {
}
public time(int hours, int minutes, String amPm) {
this.hours = hours;
this.minutes = minutes;
this.amPm = amPm;
}
public void advance(int aminutes){
if(minutes > 0){
minutes = minutes + aminutes;
while(hours < 0){
}
}
}
@Override
public String toString() {
String time = hours + " " + minutes + " " + amPm + ".";
return time;
}
}
我的代码中缺少什么,因为它显示错误?