aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes serialization Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "serialization " Watch "serialization " New topic
Author

serialization

reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I often see statement: fields declared as transient or static are IGNORED by the deserialization process. But ...




the output is

before
a is 33 b is 44
after
a is 0 b is 44

it seems static variable's value is stored properly. Then why is it saying static is the same behavior as transient ?


SCJA, SCJP5.0, SCBCD, SCWCD
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18896
    
  40

I suggest making a small change... prior to deserializing the object back from a file change b to something else. After deserialization, is b the same as when you saved it? or is it the same new value?

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
reubin haz
Ranch Hand

Joined: May 12, 2005
Posts: 287
I see. Static variable will always keep the current state value.

Thanks Henry
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: serialization