I have the following code that is supposed to create a new object from a previously saved one I'm probably overlooking something really obvious here, but can someone give me some pointers.
if ((inFileOpen==false) && fileSaved==(false))
FileDialog fDlg = new FileDialog(this,"Input File",FileDialog.LOAD);
fileName = fDlg.getFile();
if (fileName != null)
FileInputStream input = new FileInputStream(fileName);
ObjectInputStream objIn = new ObjectInputStream(input);
newStore = (Store) objIn.readObject();
inFileOpen = true;
System.out.println("cannot open file");
else if ((inFileOpen=true) && (fleSaved=true))
newStore = objIn.readObject();
I get a problem with it not recognising the file dialog constructor. Also it does not like the objIn, even though it is declared(above on line 11): ObjectInputStream objIn = new ObjectInputStream(input);
309. newStore = (Store) objIn.readObject();
*** Semantic Error: No accessible field named "objIn" was found in type "StoreView".
A few of these.
295. newStore = objIn.readObject();
*** Semantic Error: The method "java.lang.Object readObject() throws java.io.IOException, java.lang.ClassNotFoundException;" can throw the checked exception "java.lang.ClassNotFoundException", so its invocation must be enclosed in a try statement that catches the exception, or else thismethod must be declared to throw the exception.