import java.io.*;

class C implements Serializable {
	int i;
	double j;

	C(int i, double j) {
		this.i = i;
		this.j = j;
	}

	public String toString() {
		return i + ", " + j;
	}
}

class ScriviObj {
	public static void main(String[] args) {
		PrintWriter p = new PrintWriter(System.out, true);
		ObjectOutputStream oos = null;
		try {
			oos = new ObjectOutputStream(
					new FileOutputStream("miofile.dat"));

			C c = new C(15, 4.5);

			oos.writeObject(c);
		} catch (IOException e) {
			p.println(e.getMessage());
		} finally {
			try {
				if (oos != null) oos.close();
			} catch (IOException e) {
			}
		}
	}
}

class LeggiObj {
	public static void main(String[] args) {
		PrintWriter p = new PrintWriter(System.out, true);
		ObjectInputStream ois = null;
		try {
			ois = new ObjectInputStream(
					new FileInputStream("miofile.dat"));

			C c = (C) ois.readObject();

			p.println(c);
		} catch (Exception e) {
			p.println(e.getMessage());
		} finally {
			try {
				if (ois != null) ois.close();
			} catch (IOException e) {
			}
		}
	}
}
