When serializable is a marker interface, how could it make the object persistent? When the body of the interface is nothing how it it perform some action on the class that implements it?
Asked
Active
Viewed 70 times
-1
-
Welcome to Stack Overflow! We encourage you to [research your questions](http://stackoverflow.com/questions/how-to-ask). If you've [tried something already](http://whathaveyoutried.com/), please add it to the question - if not, research and attempt your question first, and then come back. – Jul 26 '12 at 10:20
1 Answers
4
Using ObjectOutputStream makes the object persistable. This class will only serialise classes marked with this interface to prevent you serialising classes which you didn't intend or cannot be serialised.
Note: Some serialisation libraries do not follow all the rules of Serialzation and can ignore the Serializable interface.

Peter Lawrey
- 525,659
- 79
- 751
- 1,130
-
1Additionally, e.g. `ObjectOutputStream` uses a variety of reflective magics to do the actual work of serialization, looking up whether you've implemented some of the special serialization methods like `writeReplace` or `writeObject(ObjectOutputStream)`. (This contributes to some of the speed complaints about Java serialization, and some of the complex fragility issues, but on the other hand, it manages to make serialization on simple objects quite easy indeed.) – Louis Wasserman Jul 26 '12 at 10:31