1. 객체 지향 프로그래밍

2. 클래스 이름 규칙
- 클래스 이름 = 오브젝트 이름
- 규칙) 첫 글자는 대문자여야 한다.(소문자일 경우 실행X)
3. 메서드 형태

메서드명() {}
4. 자바 실행 원리

(1) .java → .class 컴파일


(2) static 찾기(디버깅)
package ex01;
public class Var01 { // 1. 클래스 이름 (오브젝트)
public void main(String[] args) { // 2. 메서드 (행위) 3. main (메서드 이름)
int n1 = 10;
System.out.println(n1);
}
}

(3) main 실행(디버깅)
package ex01;
public class Var01 { // 1. 클래스 이름 (오브젝트)
public static void main2(String[] args) { // 2. 메서드 (행위) 3. main (메서드 이름)
int n1 = 10;
System.out.println(n1);
}
}

(4) 성공
package ex01;
public class Var01 { // 1. 클래스 이름 (오브젝트)
public static void main(String[] args) { // 2. 메서드 (행위) 3. main (메서드 이름)
int n1 = 10;
System.out.println(n1);
}
}

5.자바의 생명 주기
main의 시작( ‘{’ )부터 끝( ‘}’ )까지
Share article