import java.io.FileInputStream; import java.io.ObjectInputStream; public class CerealIn { public static void main(String[] args) throws Exception { FileInputStream fis = new FileInputStream("people"); ObjectInputStream ois = new ObjectInputStream(fis); try { while (true) { Object o = ois.readObject(); System.out.println("Look, I read a " + o.getClass()); // Object q = o.getClass().getConstructor(null).newInstance(null); // System.out.println(q); System.out.println(o); } // while } catch (Exception e) { System.err.println("Terminated loop because: " + e.toString()); } ois.close(); } // main(String[]) } // class CerealIn