This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
What type of variables are not serialized? Is static variable can be serialized?Is static method can be serialized?Is method can be serialized? I know that if I mark transient keyword that variable will not get serialized. Please explain it ..
When you serialize an object, static variables are not serialized. No methods, static or otherwise, are serialized -- only data is. Yes, by default, any members not marked transient will be serialized (or at least, the serialization machinery will try to do so. What else do you want to know?
When you serialize an object, you serialize the object's non-static class-level properties?
The object itself is just a pile of property data in memory. Methods are not stored in the object. That's why an object can be serialized, because its just property data?
For instance, when a reference variable is declared as a type of class, eg: String myString; //step 1 Im guessing the runtime environment knows that the myString reference can invoke methods of class String...but at this point there is no data to manipulate with this reference.
When this is called: myString = new String("asdf"); //step2 The reference variable now points to a pile of data in memory. The data can now be manipulated by invoking methods of the reference class used in step 1 (String).
Is this correct?
author and iconoclast