Code example for ObjectInputStream

Methods: closereadObject

0
			out.close();
 
			instanceOne.setI(20);
 
			// Serialize to a file 
			ObjectInput in = new ObjectInputStream(new FileInputStream(
					"filename.ser")); 
			DemoSingleton2 instanceTwo = (DemoSingleton2) in.readObject();
			in.close();
 
			System.out.println(instanceOne.getI());
			System.out.println(instanceTwo.getI());
 
		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		} 
	} 
} 
Connect your IDE to all the code out there  Get Codota for Java