• Post Reply Bookmark Topic Watch Topic
  • New Topic

Serializable

 
Matthew Jones
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an object I created that i will eventually want to save to disk and send to a server, and I'm trying to find out how to extend the serializable interface.
I went to the Sun website that gives descriptions of classes and such, but it didn't really tell how to use the serializable interface.
From what I read, it soulds like all you have to do is add the "extends serializable" to the class definition, and your done, but from what I know of Interfaces, all they do is to provide a template, and you have to provide the functionality. Can someone please tell me what I have to do to actually make my object "Serializable"?
 
Peter Tran
Bartender
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Matthew,
The java.io.Serializable interface is just a marker interface. It doesn't have any methods inside it whatsoever. It's used by other classes to determine if your class should be serializable. If you want to serialize you object, then your class must implement this interface.
Read, http://www.javasoft.com/docs/books/tutorial/essential/io/serialization.html.
-Peter
 
Matthew Jones
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks, that page makes it much clearer to me.
[This message has been edited by Matthew Jones (edited January 03, 2001).]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!