Singleton.
- By Huw Evans
- September 12, 2000
JAVA PRIMERUsing Java Object Serialization: A Few Pitfalls
Huw Evans
Listing 5. Singleton.
public class Singleton implements java.io.Serializable
{
private static Singleton s = null;
private Singleton()
{
}
public static void initialize()
{
if(s == null)
s = new Singleton();
}
public static Singleton getSingleton()
{
return s;
}
}