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.
Hello ranchers! I have a questions that I can't understand on my own. Maybe there's a sheperd out there who can show me the way? Question // I don't understand what the question means!!
Which modifier or modifiers should be used to denote a variable that should not be written out as part of its class's persistant state( Choose the shortest possible answer ). // What does class's persistant state means? A. private B. protected C. private protected D. transient E. private transient
------------------ Preparing for the Java 2 Certification exam
An instance of a class can have its state (all the values of its' member variables) written to permanent storage - a process known as serialization (can't get used to that z!). So when it says 'persistent state' it simply means the state of the object that survives and can be recreated from the serialized representation of the class. Member variables marked as transient are not included when the object is serialized - the values of these are lost. One assumes they will be given the appropriate default values when the class is recreated. So, the answer to you question is to declare the variable as transient. Cheers, Den
Joined: Jul 07, 2001
Thanks Dan for clearing this out for me Regards // Snylt Master