1

Can we Serializing/Deserializing Singleton class or class with no default or no parameter constructor in java?

if not what is the way to do it?? will creating a no parameter protected constructor help?

Jyotirup
  • 2,794
  • 9
  • 29
  • 36

2 Answers2

1

You should create a proxy object for your Singleton and serialize it in the Singleton's stead.

You can read more about proxy serialization here -> http://lingpipe-blog.com/2009/08/10/serializing-immutable-singletons-serialization-proxy/

Alexander Pogrebnyak
  • 43,823
  • 10
  • 101
  • 118
0

You can not Serializing/Deserializing Classes only instances of classes

Mark Bakker
  • 1,238
  • 8
  • 17