This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Object serialization is the process of saving an object's state to a sequence of bytes.
Does it saves only the instance variable or also the object methods(like getter and setter methods) ?
Once we we write the object to outputstream or some text file how does it get transmitted over network?
Do we write the object in a text file right?
Serialization is just about data, not methods. Also, static data is not included, since that is class behavior, not object behavior.
Whether it's a text file or a binary file depends on the method of serialization. In the Java world, most commonly it refers to binary serialization using the Object[In|Out]putStream classes. But if the objects conform to the JavaBeans standard, it's also possible to use the XML[En|De]coder classes, which produce a textual representation in XML.