import java.io.*;
class Keyboard {
}
public class MainClass implements Serializable {
private Keyboard k = new Keyboard();
public static void main(String[] args) {
MainClass c = new MainClass();
c.storeIt(c);
}
void storeIt(MainClass c) {
try {
ObjectOutputStream os = new ObjectOutputStream(new FileOutputStream("myFile"));
os.writeObject(c);
os.close();
System.out.println("done");
} catch (Exception x) {
x.printStackTrace();
}
}
}
|