I know we can serialize a class if that class implements Serializable/Externalizable interface. But, if a class doesn't implement any of these interfaces, can we still serialize that class in java. If Yes, please tell how.
Thanks in advance.
posted 6 years ago
You can't, at least not through the binary mechanism using Object[In|Out]putStream. If the class follows JavaBean conventions you can use the java.beans.XMLEncoder/XMLDecoder classes , though.
As as aside, classes are not serialized, objects are.