wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Serialization Mechanism Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Serialization Mechanism" Watch "Serialization Mechanism" New topic
Author

Serialization Mechanism

Ritu Kapoor
Ranch Hand

Joined: Oct 03, 2004
Posts: 102
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://aspose.com/file-tools
 
subject: Serialization Mechanism
 
Similar Threads
About Serialization and DeSerialization process
What is basic funda behind transient variable and it's usage in thread?
How to detect when serialization kicks off
serialization
Max. size of HttpSession attribute