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 32 33 34 35 36 37 | class Method { //int n; public static void main(String[] args) { //지역변수, Local Varibale // - 메소드나 제어문안에서 선언된 변수 //int n; 가 선언된 영역을 말함 //지역 변수의 생명주기, Life Cycle // - 영역, Scope // - 변수가 메모리에 언제 생성 ~ 소멸 // - 변수 선언문이 실행되는 순간 메모리에 할당 int n; // ->메모리에 생성되는 순간 n = 10; System.out.println(n); test(); //System.out.println(m); x }//main public static void test() { int n; int m; m = 20; System.out.println(m); //System.out.println(n); x } }//class | cs |
'WEB > JAVA' 카테고리의 다른 글
메소드5 (재귀 메소드) (0) | 2015.05.22 |
---|---|
메소드4 (메소드 오버로딩) (0) | 2015.05.22 |
메소드2 (구성요소) (0) | 2015.05.22 |
메소드1 (0) | 2015.05.22 |
연산자 (0) | 2015.05.22 |