// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class Ser1 {
    public static void write(String s1, String s2) throws IOException {
        PrintWriter pw = new PrintWriter(new FileWriter("/work/z.ser"));
        pw.println(s1);
        pw.println(s2);
        pw.close();
    }
    public static void readAndDisplay() throws IOException {
        BufferedReader br = new BufferedReader(new FileReader("/work/z.ser"));
        String s1 = br.readLine();
        String s2 = br.readLine();
        br.close();
        System.out.printf("%s %s\n", s1, s2);
    }
    public static void main(String[] args) throws IOException {
        write("ABC", "DEF");
        readAndDisplay();
    }
}
