wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes transient variable? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "transient variable?" Watch "transient variable?" New topic
Author

transient variable?

srikanth reddy
Ranch Hand

Joined: Jul 28, 2005
Posts: 252
hi frnds

i have got a doubt regarding transient variable while reading Heller and Roberts book...

Which of the following statements is true?
A.Transient methods may not be overridden.
B.Transient methods must be overridden.
C.Transient classes may not be serialized.
D.Transient variables must be static.
E.Transient variables are not serialized.



here the answer given is E.i just wanted to know that why not transient variable be static and also i feel that they can be serializable .

please can anyone clear my doubt

thanks & regards

srikanth


Thanks & Regards<br /> <br />-Srikanth
Santana Iyer
Ranch Hand

Joined: Jun 13, 2005
Posts: 335
transient can only be applied to variables,

transient keyword is used its meaning is that they are not to be serialized
read about it.
Will Fleming
Greenhorn

Joined: Sep 28, 2005
Posts: 20
I think the key word in answer D is *must*.

You can, but you don't have to, thus the statement isn't true.

Thinking some more on it, I don't see why a static variable would be serialized anyway. The only thing that you would 'save' during serialization would be the instance variables.

Either way, D is not correct.

[ October 04, 2005: Message edited by: Will Fleming ]
[ October 04, 2005: Message edited by: Will Fleming ]

SCJP 1.5
 
Consider Paul's rocket mass heater.
 
subject: transient variable?
 
Similar Threads
Doubt in StackOverflowError
Transient variables
Is transient allowed with static?
Why are transient static variables allowed?
Serializable