I have read in a book that if a singleton class is serialized and deserialized more than once, there will be multiple objects and not a singleton. Why is it so ? Please explain this with an example . Thanks in advance .
When we call object is singleton object then we have static instance of itself and private constructor that why object called as singleton but in serialization static members are not allowed to serialize and when it is going to deserialized then it only recreate the object with the state without using constructor and without using static factory method that's why in deserialization object lost the singleton property.
As per my knowledge i share my knowledge if you have any doubt or you think it's then please ask or post the correct answer.i am 95% this is correct answer.