Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
The moose likes Beginning Java and the fly likes please help me on how to serialise static variables, if possible Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "please help me on how to serialise static variables, if possible" Watch "please help me on how to serialise static variables, if possible" New topic
Author

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

raja pulleboina
Greenhorn

Joined: Dec 10, 2009
Posts: 12
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
Marshal

Joined: Mar 22, 2005
Posts: 41108
    
  45
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?


Ping & DNS - my free Android networking tools app
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

Just use a java.io.ObjectOutputStream and store them in a file


"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
raja pulleboina
Greenhorn

Joined: Dec 10, 2009
Posts: 12
thanks a lot wounter and ulf
 
 
subject: please help me on how to serialise static variables, if possible
 
Similar Threads
Java Serialization: Static Member Variables
Serialization
Serailzable Problem....
partial serialisation...
Serialization in java