易
易名烦
Unregistered / Unconfirmed
GUEST, unregistred user!
(Appointment)AppointmentList.elementAt(i).Edit();
会报Appointment没有声明,面同一个方法中的
Appointment a = Appointment.GetAppointment();可以顺利通过.
其中
AppointmentList是一个容器.
完整方法代码:
private void addAppointment() {
Appointment a = Appointment.GetAppointment();
for (i = 0;
i < AppointmentList.size();
i++) {
if (AppointmentList.elementAt(i).equals(a)) {
int choice = Integer.parseInt(JOptionPane.showInputDialog(
"The appointment already exists:/n"
+ "1.Delete /n 2. Edit /n 3.EXIT"));
switch (choice) {
case 1:
AppointmentList.remove(AppointmentList.elementAt(i));
case 2:
(Appointment)AppointmentList.elementAt(i).Edit();
default:
return;
}
}
}
AppointmentList.add(a);
}
会报Appointment没有声明,面同一个方法中的
Appointment a = Appointment.GetAppointment();可以顺利通过.
其中
AppointmentList是一个容器.
完整方法代码:
private void addAppointment() {
Appointment a = Appointment.GetAppointment();
for (i = 0;
i < AppointmentList.size();
i++) {
if (AppointmentList.elementAt(i).equals(a)) {
int choice = Integer.parseInt(JOptionPane.showInputDialog(
"The appointment already exists:/n"
+ "1.Delete /n 2. Edit /n 3.EXIT"));
switch (choice) {
case 1:
AppointmentList.remove(AppointmentList.elementAt(i));
case 2:
(Appointment)AppointmentList.elementAt(i).Edit();
default:
return;
}
}
}
AppointmentList.add(a);
}