import java.io.*; class Dolgozo implements Serializable { String nev; Integer kor; } class Program01 { private static void make() throws IOException { Dolgozo joska = new Dolgozo(); joska.nev = "Nagy József"; joska.kor = 35; Dolgozo mari = new Dolgozo(); mari.nev = "Kis Mária"; mari.kor = 28; FileOutputStream fs = new FileOutputStream("adat.dat"); ObjectOutputStream os = new ObjectOutputStream(fs); os.writeObject(joska); os.writeObject(mari); os.close(); } private static void load() throws IOException, ClassNotFoundException { Dolgozo joska = null; Dolgozo mari = null; FileInputStream fs = new FileInputStream("adat.dat"); ObjectInputStream os = new ObjectInputStream(fs); joska = (Dolgozo) os.readObject(); mari = (Dolgozo) os.readObject(); os.close(); System.out.println("Név: " + joska.nev); System.out.println("Név: " + mari.nev); } public static void main(String[] args) throws IOException, ClassNotFoundException { //~ make(); load(); } }