[Java] 1. 자바의 특징

백하림's avatar
Feb 03, 2025
[Java] 1. 자바의 특징

1. 객체 지향 프로그래밍

notion image

2. 클래스 이름 규칙

notion image
ex01 우클릭 - New - Java Class 클릭
notion image
💡
여기서 중요한 점 : 첫 글자 꼭 대문자 사용해야 한다. 패키지와 헷갈리지 않기 위해서이다.

3. 메소드 생긴 꼴

notion image
💡
메소드 이름 ( ) { }

4. 자바 실행 원리

notion image

(1) .java → .class 컴파일

package ex01; public class Var01 { // 1. 클래스 이름 (오브젝트) public static void main(String[] args) { // 2. 메소드 (행위) 3. main (메소드 이름) int n1 = 10; System.out.println(n1); } }
코드를 실행해보자 !
notion image
src - ex01 - .java 파일이 생성된 것을 볼 수 있다.
notion image
Var01 우클릭 - Open In - Explorer
notion image
out - production - study - ex01에 .class파일이 생성된 것을 볼 수 있다.

(2) static을 찾는다.(디버깅)

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

(3) main을 실행한다. (디버깅)

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

(4) 성공

package ex01; public class Var01 { // 1. 클래스 이름 (오브젝트) public static void main(String[] args) { // 2. 메소드 (행위) 3. main (메소드 이름) int n1 = 10; System.out.println(n1); } }
notion image
10 이라고 출력이 잘 된다.
Share article

harimmon