• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Serialization Mechanism

 
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can anyone pls help me to understand the serialization mechanism in details.

Regards,
Ritu
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic