This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
 
Don't get me started about those stupid light bulbs.
 
subject: Singleton Pattern - toClone
 
Similar Threads
Hibernate SessionFactory is initialized/read with every EJB call
Limited no of Objects
how to make single instance of a class?
Static methods Vs "Instance Methods"
running only one instance of java program