i have some doubts in some core java topics. i am writing list of the questions. thanks a lot in advance.
1) can we clone a singleton instance? do we need to implement clonable interface for this? if so then why because clone method is available in Object class.
2) If we clone the object it will loose its singleton property. so to stop cloning what we can do?
3) if we serialize an object and De serialize it twice how many objects we will get?
If an object is meant to be a singleton, then you probably don't want to let it be cloned. Therefore, you should not implement the cloneable interface. And if you don't, calling the clone() method inherited from the Object class throws an exception, if i recall correctly.
So the answer to #2 is to not implement the cloneable interface.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors