import java.io.ObjectOutputStream;
import java.io.FileOutputStream;
import java.io.IOException;

public class Write {

	public static void main(String [] args) {
		try {
		// Write to disk with FileOutputStream
		FileOutputStream f_out = new 
			FileOutputStream("myobject.data");

		// Write object with ObjectOutputStream
		ObjectOutputStream obj_out = new
			ObjectOutputStream (f_out);

		Data myObject = new Data("foo", "bar");
		// Write object out to disk
		obj_out.writeObject ( myObject );
		} catch(IOException ex)
		{
			ex.printStackTrace();
		}
	}
}

