• Post Reply Bookmark Topic Watch Topic
  • New Topic

Why transient variables are not serialized ?.  RSS feed

 
Praveen Kumar
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

Everyone know that transient variables are not serialized. I want to know why ?.

Is that transient varibles stored in differern location say registers , where as normal instance varibles stroed in heap memory.

Please explain me detailly.

Thanks a lot.
Praveen kumar
 
Wouter Oet
Bartender
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Transient variables are not serialized because that is the definition of transient. Transient doesn't do anything except for excluding the variable from serialization. It is not stored somewhere else then "normal" objects.
 
Sridhar Santhanakrishnan
Ranch Hand
Posts: 317
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is the definition of a transient variable. Its used when you dont want a variable value to be persisted as part of object serialisation.

<edit>Wouter was quicker<edit>
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!