• Post Reply Bookmark Topic Watch Topic
  • New Topic

Static veriable serialization ?  RSS feed

 
Anand Jooshi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi ,

How are you?

Can you help me about serialization?

How to serialize a static variable? Yes, it doesn’t make sense to serialize a static variable but if my object having a static int variable having value as 10. Then how can I get this value after deserialization ?

Do I need to write any special code for this?

Thanks ,
 
Rob Spoor
Sheriff
Posts: 20895
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could implement the readObject and writeObject methods.

Moving to I/O.
 
Anand Jooshi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Thanks for your reply ...


Does it means serializing static value using intWrite() and intRead() or similar kind of methods in witeObject() and readObject() methods of Externizable interface. ?


Didn't understand "Moving to I/O" !


Thanks,

 
Henry Wong
author
Sheriff
Posts: 22852
119
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Anand Jooshi wrote:
Does it means serializing static value using intWrite() and intRead() or similar kind of methods in witeObject() and readObject() methods of Externizable interface. ?


Here's a Sun article that explains the usage of the readObject and writeObject methods...

http://java.sun.com/developer/technicalArticles/ALT/serialization/

Didn't understand "Moving to I/O" !


Basically, this topic has been moved to the IO forum. Take a look above, and you'll notice that it is not in the same forum that you originally posted in.

Henry
 
Anand Jooshi
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

thanks Henry !!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!