you can serialize the object a class only if this class implements code example Example: import java.io.serializable import java.io.Serializable;