Language/Java
Java - 초기화 순서
galid1
2018. 10. 28. 13:28
728x90
JAVA 초기화 순서
1. static 변수
2. 인스턴스 변수
3. 생성자
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | public class ClassLoad { static { System.out.println("static 영역"); } { System.out.println("인스 턴스 영역"); } public ClassLoad() { System.out.println("생성자 호출"); } public static void main(String[] args) { // TODO Auto-generated method stub ClassLoad load; load = new ClassLoad(); } } | cs |
결과