Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

serialization

 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ?
 
Henry Wong
author
Marshal
Pie
Posts: 20835
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
reubin haz
Ranch Hand
Posts: 287
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. Static variable will always keep the current state value.

Thanks Henry
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic