Package1 2. 변수(variable)_(package, psvm) package 자바에서 패키지는 관련 클래스들을 그룹화 하고, 클래스들 간 이름 충돌을 방지하기 위한 네임스페이스를 제공하는 방법이다. 소스코드(src)의 최상단에 위치함. public static void main(String[] args) { ... } 메인 메서드 클래스의 메인 메서드 톺아보기. public - 메인 메서드는 다른 클래스에서도 접근 가능해야 하기 때문에 public 접근 제어자 사용. static - 메인 메서드는 객체 인스턴스 생성하지 않고 호출됨. 클래스에 속한 정적 메서드(타입 메서드) (메서드의 로컬 변수 및 매개변수는 메서드가 호출될 때 스택 영역에 저장됨 -> 종료 시 메모리에서 해제) void - main메서드는 반환값이 없음. (자바는 메서드의 반환 타입이 메서드 이름.. 2024. 1. 7. 이전 1 다음