Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Serializable interface

 
Vallabhaneni Suresh Kumar
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The objects can be serialized if we extends Serializable interface. Then what are the purpose of writeObect() and readObject() methods? If we want to handle the serialization ourselves, we need to implement these methods or what?

Thank you
 
Ulf Dittmer
Rancher
Pie
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Basically, yes. But if you want to handle serialization yourself, you should implement Externalizable instead of Serializable (and use readExternal/writeExternal, not readObject/writeObject).
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic