我正在创建一个程序,用户输入姓名,身份证号码,日期,电子邮件和课程选择,然后将其保存到文件中。这是我的代码:
private class LoadMenuHandler implements EventHandler<ActionEvent> {
public void handle(ActionEvent event) {
try (ObjectInputStream loadData = new ObjectInputStream(new FileInputStream("ModuleChoices.dat"));) {
profile = (StudentProfile) loadData.readObject();
System.out.println("loaded");
} catch (FileNotFoundException fnfExcept) {
System.out.println("not found");
} catch (IOException ioExcept) {
System.out.println("Error loading");
} catch (ClassNotFoundException e) {
System.out.println("Class not found");
}
createProfile.setLoadProfile(profile);
}
}