aspose file tools*
The moose likes Beginning Java and the fly likes Questions from Complete Java 2 Certification Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Questions from Complete Java 2 Certification" Watch "Questions from Complete Java 2 Certification" New topic
Author

Questions from Complete Java 2 Certification

Snylt Master
Ranch Hand

Joined: Jul 07, 2001
Posts: 55
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

Thanks!

------------------
Preparing for the Java 2 Certification exam


Preparing for the Java 2 Certification exam
Dennis Hicks
Greenhorn

Joined: Jul 09, 2001
Posts: 12

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
Snylt Master
Ranch Hand

Joined: Jul 07, 2001
Posts: 55
Thanks Dan for clearing this out for me
Regards
// Snylt Master
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Questions from Complete Java 2 Certification