Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

please help me on how to serialise static variables, if possible

 
raja pulleboina
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do we serialize static variables in java ???

if yes...,

please let it publish her how to serialize static variables in java ...

thanks
regards
raja
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Static fields are part of the class, not of any instantiated object of that class, so they're not saved if an object is serialized. Does that answer your question?
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just use a java.io.ObjectOutputStream and store them in a file
 
raja pulleboina
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks a lot wounter and ulf
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic