[JAVA] 13. 자바의 특징

서회정's avatar
Feb 03, 2025
[JAVA] 13. 자바의 특징

 

1. 객체 지향 프로그래밍

💡
자바(Java)
객체 지향 프로그래밍
→ 상태는 행위를 통해 변경된다.
notion image
행위가 일어났을 때, 상태가 변할 수 있도록 코드를 짜는 것
⇒ 객체 지향 언어의 특징이다.

2. Class 이름 규칙

class 이름(오브젝트 이름)
첫 글자는 대문자!

3. method(메서드) 생긴 꼴

( ){ } → 소괄호와 중괄호가 있는 모양이다
 
다음은 예시 코드 입니다. 여기서 4번째 줄을 메서드라 한다.
notion image

4. 자바 실행 원리

notion image

1) .java → .class

notion image
 

2) static 찾기 (디버깅)

package ex01; public class Var01 { // 1. 클래스 이름(오브젝트) public void main(String[] args) { // 2. 메서드(행위) 3. main (메서드 이름) int n1 = 10; System.out.println(n1); } }
 
static이 존재하지 않을 시 나타나는 에러 메세지
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); } }
 
main을 찾지 못할 때 나타나는 에러 메세지
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
Share article

clubnerdy