aspose file tools
The moose likes Java in General and the fly likes Serializing a class in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serializing a class in Java" Watch "Serializing a class in Java" New topic

Serializing a class in Java

Raj Kumar Bindal
Ranch Hand

Joined: Apr 15, 2006
Posts: 418
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.

Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42954
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.
Have you tried LearnNowOnline?
subject: Serializing a class in Java