Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: indentation

...

Code Block
bgColor#FFcccc
String filename = "serial";
try(ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filename))) {
  // Serializing using writeUnshared
  oos.writeUnshared(jane);
} catch (Exception e) {
	    System.out.println("Exception during serialization" + e);
}

// Deserializing using readUnshared
try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename))){
	Professor jane2 = (Professor)ois.readUnshared();
	System.out.println("checkTutees returns: " +
							 jane2.checkTutees());
} 
 catch (Exception e) {
	    System.out.println("Exception during deserialization" + e);
}

...

Code Block
bgColor#ccccff
String filename = "serial";
try(ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream(filename))) {
	// Serializing using writeUnshared
	oos.writeObject(jane);
} 
catch catch (Exception e) {
 	 System.out.println("Exception during serialization" + e);
} 

// Deserializing using readUnshared
try(ObjectInputStream ois = new ObjectInputStream(new FileInputStream(filename))) {
Professor jane2 = (Professor)ois.readObject();
System.out.println("checkTutees returns: " +
					 jane2.checkTutees());
} 
catch catch (Exception e) {
	    System.out.println("Exception during deserialization" + e);
} 

...