Skip to content

Instantly share code, notes, and snippets.

@fernandobgi
Created July 10, 2012 16:51
package br.com.ocjp.serializable;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.ObjectInputStream;
public class Input {
public static void main(String[] args) throws IOException, ClassNotFoundException {
FileInputStream f = new FileInputStream("C:\\temp\\animal.ser");
ObjectInputStream in = new ObjectInputStream(f);
Dog a2 = (Dog)in.readObject();
System.out.println("Age ==> " + a2.age);
System.out.println("Name ==> " + a2.name);
System.out.println("Kind ==> " + a2.kind);
System.out.println("Owner ==> " + a2.owner);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment