• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

transient variable?

 
srikanth reddy
Ranch Hand
Posts: 252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Santana Iyer
Ranch Hand
Posts: 335
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic