블로그 이미지

calendar

1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
  • total
  • today
  • yesterday
2011. 4. 27. 16:45 JAVA언어
  1. public class Singleton {
    // Private constructor prevents instantiation from other classes
  2.    private Singleton() {}
  3. /**
  4. * SingletonHolder is loaded on the first execution of Singleton.getInstance()
    * or the first access to SingletonHolder.INSTANCE, not before.
    */
  5. private static class SingletonHolder {
  6. private static final Singleton INSTANCE = new Singleton();
  7. }
  8. public static Singleton getInstance() {
       return SingletonHolder.INSTANCE;

    }
  9. }

'JAVA언어' 카테고리의 다른 글

MySQL JDBC INSERT 시 AUTO INCREMENT 값을 알아내는 예제  (0) 2011.10.05
String 컴파일  (0) 2011.08.05
exepiton message printStackTrace처럼 찍기  (0) 2011.04.16
data DownLoad 코드  (0) 2011.02.09
jnid lookup / datasource 코드  (0) 2011.01.13
posted by 천상의날개