Results 1 to 1 of 1
Thread: Singleton Pattern
-
Singleton Pattern
Singleton is object of a class that can be created, but it can't be instantiated by the developers. Review the code below:
Java Code:public class SingletonObject { private SingletonObject() { } public static SingletonObject getSingletonObject() { if (ref == null) // can call this constructor ref = new SingletonObject(); return ref; } public Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } private static SingletonObject ref; }
Similar Threads
-
Whether to make Bean Singleton or non Singleton (prototype)
By Java Tip in forum Java TipReplies: 0Last Post: 03-29-2008, 12:41 PM -
Whether to make Bean Singleton or non Singleton (prototype)
By JavaBean in forum Java TipReplies: 0Last Post: 09-26-2007, 08:32 PM -
singleton pattern
By Peter in forum Advanced JavaReplies: 1Last Post: 07-09-2007, 04:45 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks