Here you can find the source of serializeObject(Serializable obj, String filename)
public static void serializeObject(Serializable obj, String filename)
//package com.java2s; //License from project: Open Source License import java.io.FileOutputStream; import java.io.ObjectOutputStream; import java.io.IOException; import java.io.Serializable; public class Main { public static void serializeObject(Serializable obj, String filename) { try {/* w ww. j a va 2 s . c o m*/ FileOutputStream fos = new FileOutputStream(filename); ObjectOutputStream os = new ObjectOutputStream(fos); os.writeObject(obj); os.close(); } catch (IOException e) { e.printStackTrace(); System.exit(1); } } }