Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import java.io.File;
import java.io.FileInputStream;
import java.io.ObjectInputStream;

public class Main {
    public static void main(String[] args) {
        File fileObject = new File("person.ser");

        try (ObjectInputStream ois = new ObjectInputStream(new FileInputStream(fileObject))) {

            Person p1 = (Person) ois.readObject();
            Person p2 = (Person) ois.readObject();
            Person p3 = (Person) ois.readObject();

            System.out.println(p1);
            System.out.println(p2);
            System.out.println(p3);

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}