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(); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter