Here you can find the source of saveObject(Object o, File f)
static void saveObject(Object o, File f)
//package com.java2s; /*//from w w w. j av a 2 s . c o m * Copyright 2011 Holger Brandl * * This code is licensed under BSD. For details see * http://www.opensource.org/licenses/bsd-license.php */ import java.io.*; public class Main { static void saveObject(Object o, File f) { try { FileOutputStream fout = new FileOutputStream(f); ObjectOutputStream oos = new ObjectOutputStream(fout); oos.writeObject(o); oos.close(); } catch (Exception e) { throw new RuntimeException(e); } } }