File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Serializable Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Serializable" Watch "Serializable" New topic
Author

Serializable

sun par
Ranch Hand

Joined: Oct 03, 2002
Posts: 257
All interfaces have public methods by default. So why in the case of Serializable interface one has to provide the exact methods


Thanks


Sunita<br />SCJP 1.4
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Serializable has no methods. It is a tagging interface only. From the API docs:
Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized.
Michael Morris


Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
Greg Charles
Sheriff

Joined: Oct 01, 2001
Posts: 2771
    
  10

As Michael say, Serializable has no methods. You don't have to do anything to implement Serializable (other than say you are doing it). However, if you want to control the serialization and deserialization in a different way from the default, you implement those writeObject() and readObject() methods. In practice you don't have to do that very often.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Serializable
 
Similar Threads
IBM 286 - patterns
ObjectInputStream question
Is there any cost associated with the implementation of Serializable interface?
Serialize an object that contains non-serializable objects
Object serialization