싱글톤

public class Singleton { private static final Singleton getInstance = new Singleton(); public static Singleton getInstance(){ return getInstance; } private Singleton() {} } public class Main { public static void main(String[] args) { Singleton singleton1 = Singleton.getInstance(); Singleton singleton2 = Singleton.getInstance(); if(singleton1 == singleton2){ System.out.println("같음"); } else{ Syst..
솜사탕코튼
'싱글톤' 태그의 글 목록