aspose file tools
The moose likes Java in General and the fly likes Serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Serialization" Watch "Serialization" New topic
Author

Serialization

Manish Malhotra
Greenhorn

Joined: Apr 05, 2003
Posts: 29
Dear friends,
What are the extra property added by java when a class implements Serailizable interface.
Because Serailizable is a no method inter.
We make that particular classes object persistent, that is OK but else then it, there should be something reason to declare this interface.
Michael Morris
Ranch Hand

Joined: Jan 30, 2002
Posts: 3451
Serializable is simply a tagging interface. It instructs the JVM that it is OK to serialize objects of the implementing class either for pesistance or transmission. Why does the JVM insist that an object be Serializable before persisting or transmitting it? In a word security. The same is true of the Cloneable interface but there are issues other than security involved with Cloneable since the default Object.clone() only produces a shallow copy of the object which can cause problems with classes that hold references to mutable objects. Back to Serializble, RMI requires an object to either implement Remote (yet another tagging interface) or Serializble for transmission. RMI is used in Java's version of distributed client/server architechture as well as EJBs.


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
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 26184
    
  66

It's not required, but it's a good idea to have a static variable called serialuid. This number can be generated using the serialver tool. It helps the JVM serialize the class slightly faster because it doesn't need to calculate the serialuid each time.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Serialization
 
Similar Threads
What the hell is a serialized object?
urgent serialize of getSession()
Batch update returned unexpected
About Serializable
What is Marker Or Tagged Interface.Why it need?