Kaustubh G Sharma wrote:in both the cases new object has been created...?
It depends.
The contract for Object.clone() specifically says that x.clone() == x is allowed, so if your singleton class needs to be Cloneable* you override clone() to return "this".
As for Serializable, if a singleton needs to be Serializable** then
you should use the readResolve method. Look it up if you're not familiar with it.
Both will lead to the singleton object being used instead of a new object being created.
* and it usually shouldn't be. The only reason I can think of is when you are sub classing a Cloneable class.
** again, it usually shouldn't be. Again it should only be used if you are sub classing a Serializable class.