Here you can find the source of saveObject(Object obj, File file)
public static void saveObject(Object obj, File file)
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { public static void saveObject(Object obj, File file) { try {//from w w w. jav a 2s . co m ObjectOutputStream stream = new ObjectOutputStream(new FileOutputStream(file)); stream.writeObject(obj); stream.close(); } catch (IOException e) { e.printStackTrace(); } } }