wood burning stoves 2.0*
The moose likes Java in General and the fly likes  serialize an object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark " serialize an object" Watch " serialize an object" New topic
Author

serialize an object

Saral Saxena
Ranch Hand

Joined: Apr 22, 2011
Posts: 202

try to serialize an object of a class which implements Serializable, but the object includes a reference to an non- Serializable class then a ‘NotSerializableException’ will be thrown at runtime..how can we avoid this through prefixing transient ..!!

Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

Saral Saxena wrote:try to serialize an object of a class which implements Serializable, but the object includes a reference to an non- Serializable class then a ‘NotSerializableException’ will be thrown at runtime..how can we avoid this through prefixing transient ..!!



Just look for how to use Transient key word.

Or the classes of those objects should also implement Serializable.

I would suggest you to start with a tutorial on Serialisation, it will help you a lot in clearing all these queries.


Mohamed Sanaulla | My Blog
Jeff Verdegan
Bartender

Joined: Jan 03, 2004
Posts: 6109
    
    6

Saral Saxena wrote:try to serialize an object of a class which implements Serializable, but the object includes a reference to an non- Serializable class then a ‘NotSerializableException’ will be thrown at runtime..how can we avoid this through prefixing transient ..!!



Please stop posting questions without doing any research first.
 
GeeCON Prague 2014
 
subject: serialize an object