Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Serializable interface  RSS feed

 
parra matta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

In the API spec for Serializable, it says:

Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:


private void writeObject(java.io.ObjectOutputStream out)
throws IOException
private void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException;

May I ask where these two methods are defined?

Thanks.
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
These methods are not defined in any interface. It's just about how to use take control of serialization of your objects. Default serialization will be used when these methods are not implemented.
 
parra matta
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. That's clear
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!