| Author |
Serialization Doubt
|
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
here rob is transient variable...but still i can serialize the variable?? please anyone clarify the doubt
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32644
|
|
|
Will that class compile?
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
|
yes
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32644
|
|
It didn't compile when I tried it. There is no "a" declared.
And I will let you out of your misery by giving you the Java™ Language Specification link.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Campbell Ritchie wrote:It didn't compile when I tried it. There is no "a" declared.
i am sorry. when i copy and past, forget to paste the declaration of "a". i changed the above my post.
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Campbell Ritchie wrote:
And I will let you out of your misery by giving you the
Really it helped me lot. Thank you Campbell .
|
 |
Campbell Ritchie
Sheriff
Joined: Oct 13, 2005
Posts: 32644
|
|
You're welcome
You learned a lot more by having to look up the JLS than if I had simply said "no" to your first question.
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Cool, an entire class named after me!
Transient fields are ignored when the object they are declared in is serialized, but if you serialize them directly (like in your code) then they will get serialized.
If you would have replaced "writeObject(rob)" with "writeObject(this)", then the rob field would most definitely be skipped.
|
SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
|
 |
Seetharaman Venkatasamy
Ranch Hand
Joined: Jan 28, 2008
Posts: 5575
|
|
Thanks Rob
|
 |
Maneesh Godbole
Saloon Keeper
Joined: Jul 26, 2007
Posts: 8434
|
|
Rob Prime wrote:Cool, an entire class named after me! 
I wonder of int "a=10" refers to age
|
[Donate a pint, save a life!] [How to ask questions] [Onff-turn it on!]
|
 |
Rob Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
Maneesh Godbole wrote:
Rob Prime wrote:Cool, an entire class named after me! 
I wonder of int "a=10" refers to age
Only mentally.
|
 |
 |
|
|
subject: Serialization Doubt
|
|
|