我不知道为什么我不断收到此错误:
在我的方法中,我有:
int option;
Object message[] = new Object[6];
message[0] = firstName;
message[1] = txtfirstName;
message[2] = lastName;
message[3] = txtlastName;
message[4] = gender;
message[5] = txtgender;
int response = JOptionPane.showConfirmDialog(null,message,"Register a Person",JOptionPane.OK_CANCEL_OPTION , JOptionPane.QUESTION_MESSAGE);
Parent parent = new Parent(txtfirstName.getText(),txtlastName.getText(),txtgender.getText());
creche.add(parent);`
在我的主要我有设置:
ArrayList<Parent> parent = new ArrayList<Parent>();
List<Person> school = new ArrayList<Person>();
MyApp app = new MyApp ();
`
我有子类父子类和超类人。
错误:Parent parent = new Parent(var1,var2,var3,var4);
但这有效:Child child = new Child(var1,var2,var3,var4);
creche.add(child);
有什么帮助吗?