This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Serialization Mechanism 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 » Certification » Programmer Certification (SCJP/OCPJP)
Reply Bookmark "Serialization Mechanism" Watch "Serialization Mechanism" New topic
Author

Serialization Mechanism

Ritu Kapoor
Ranch Hand

Joined: Oct 03, 2004
Posts: 101
Can anyone pls help me to understand the serialization mechanism in details.

Regards,
Ritu
Raef Kandeel
Ranch Hand

Joined: Aug 05, 2007
Posts: 87
It is very hard to explain serialization mechanism in details in a forum. Try to be more specific. What exactly don't you understand about serialization. You can use the following just as guidelines.

1) Serialization is a powerful technique that allows you to write and read the state of the object to and from text files.

2) Instance variables that is marked as transient are not serializable meaning that they cannot be written or read from text files.

3) Any class that is to be serialized or de-serialized must implement the serializable interface which is a marker interface with no methods to implement.

4) All classes that exhibit has-a relationship must implement the serializable interface if the class is to be serialized. Otherwise, an exception is thrown at runtime and the objects cannot be serialized.

5) All classes that exhibit is-a relationship must not implement the serializable interface if the object is to be serialized. You can remember that by the fact that the Object class does not implement serializable and yet all the subclasses are able to implement it. However, if they don't implement serializable, then when the super() is called, the instance variables return to their default values.

6) you can override the writeObject and readObject methods in order to write and read Objects to text files in a specific way.


SCJP, SCWCD
 
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 Mechanism
 
Similar Threads
What is basic funda behind transient variable and it's usage in thread?
Max. size of HttpSession attribute
serialization
About Serialization and DeSerialization process
How to detect when serialization kicks off