public static class Singleton1
{
pirvate static final Singleton1 theInstance = new Singleton1();
public static Singleton1 getInstance()
{
return theInstance;
}
}
혹은...
public static class Singleton2
{
private static Singleton2 theInstance;
public static synchronized Singleton2 getInstance()
{
if (theInstance == null)
theInstance = new Singleton2();
return theInstance;
}
}
'Java' 카테고리의 다른 글
[Java] X Window 없이 JDK 1.3 + PJA Toolkit 으로 썸네일 구현하기 (0) | 2007.04.14 |
---|---|
[UNIX] crontab에서 자바프로그램 실행(한글문제 해결법) (1) | 2007.04.11 |
[Java] ftp client (0) | 2007.01.09 |
[Java] Creating an SSL Client Socket (0) | 2007.01.09 |
[Java] 한글체크 (0) | 2007.01.09 |