Here you can find the source of saveObject(String filePath, Serializable obj)
public static void saveObject(String filePath, Serializable obj)
//package com.java2s; //License from project: Open Source License import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; import java.io.Serializable; public class Main { public static void saveObject(String filePath, Serializable obj) { FileOutputStream fos = null; ObjectOutputStream out = null; try {/* ww w . ja v a2 s .com*/ fos = new FileOutputStream(filePath); out = new ObjectOutputStream(fos); out.writeObject(obj); out.close(); } catch (IOException ex) { ex.printStackTrace(); } } }