Requires Free Membership to View
public class MySingleton
{
static private MySingleton instance = null;
static public MySingleton getInstance()
{
if (null == instance)
{
instance = new MySingleton();
}
return instance;
}
// The constructor is made private to prevent direct instantiation
// of this class from external objects.
private MySingleton()
{
}
}
This was first published in August 2004

Join the conversationComment
Share
Comments
Results
Contribute to the conversation