...
Code Block | ||
---|---|---|
| ||
String filename = "serial"; try { // Serializing using writeUnshared ObjectOutputStream oos = new ObjectOutputStream (new FileOutputStream(filename)); oos.writeUnshared(jane); oos.close(); // Deserializing using readUnshared ObjectInputStream ois = new ObjectInputStream (new FileInputStream(filename)); Professor jane2 = (Professor)ois.readUnshared(); ois.close(); System.out.println("checkTutees returns: " + jane3jane2.checkTutees()); // prints "checkTutees returns: false" } catch(Exception e) { System.out.println("Exception during deserialization" + e); } |
...