public class Person implements Serializable { public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException { FileInputStream fileInputStream = new FileInputStream("persons.txt"); ObjectInputStream objectInputStream = new ObjectInputStream(fileInputStream); Person michaelCopy = (Person) objectInputStream.readObject(); Person peterCopy = (Person) objectInputStream.readObject(); } }