File = new File("serialisiertes_objekt.bin");
Serializable object = .. // <-- Das hier ist dein Objekt, das du serialisierst
ObjectOutputStream out = null;
try {
out = new ObjectOutputStream(new FileOutputStream(file));
out.writeObject(val);
out.flush();
} catch (IOException e) {
e.printStackTrace(System.err);
} finally {
try {
out.close();
} catch (IOException e) {
//nevermind
}
}