Here you can find the source of serialize(Object obj, String fileName)
public static void serialize(Object obj, String fileName) throws IOException
//package com.java2s; //License from project: Apache License import java.io.FileOutputStream; import java.io.IOException; import java.io.ObjectOutputStream; public class Main { public static final String FILE_DIR = "src/com/warouss/io/serialization/"; public static void serialize(Object obj, String fileName) throws IOException { FileOutputStream fos = new FileOutputStream(FILE_DIR + fileName); ObjectOutputStream oos = new ObjectOutputStream(fos); oos.writeObject(obj);// w ww . j ava2s . c o m fos.close(); } }