wood burning stoves 2.0*
The moose likes Java in General and the fly likes Singleton Pattern - toClone Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Singleton Pattern - toClone" Watch "Singleton Pattern - toClone" New topic
Author

Singleton Pattern - toClone

aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
In Singleton Pattern do I need to override toClone method
Regards,
aakash
Marcus Howarth
Ranch Hand

Joined: Jan 04, 2002
Posts: 37
Hi Aakash,
Not according to this link:
Singleton Pattern
why did you think you should?


Marcus<br /> <br />SCJP, March '02
aakash bhatt
Ranch Hand

Joined: Jan 09, 2003
Posts: 182
All objects have the toClone method so in singleton patten if i call the toClone method will it make another instance of the Singleton class
Anonymous
Ranch Hand

Joined: Nov 22, 2008
Posts: 18944
you can only call Object.clone() if you also implement the Clonable interface in your class. Check out J2SE API description here and have a look
at java.lang.Cloneable
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Singleton Pattern - toClone