Here you can find the source of isSerializable(Object o)
public static boolean isSerializable(Object o) throws IOException
//package com.java2s; //License from project: Apache License import java.io.*; public class Main { public static boolean isSerializable(Object o) throws IOException { if (!(o instanceof Serializable)) { return false; }//from w w w. j a v a2s . c o m try { // Let's test to make sure, the object may consist of an object that is not serializable new ObjectOutputStream(new ByteArrayOutputStream()).writeObject(o); return true; } catch (NotSerializableException nse) { return false; } } }