• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serialize an object

 
Saral Saxena
Ranch Hand
Posts: 203
Eclipse IDE Java Oracle
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3159
33
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic