File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Singleton Pattern - toClone

aakash bhatt
Ranch Hand

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

Joined: Jan 04, 2002
Posts: 38

Hi Aakash,
Not according to this link:
Singleton Pattern
why did you think you should?


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
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:
subject: Singleton Pattern - toClone
It's not a secret anymore!