Notice
Recent Posts
Recent Comments
«   2024/09   »
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
Archives
Today
Total
관리 메뉴

충분히 쌓여가는

6.4 객체 생성과 클래스 변수 - 라이브러리와 실행 클래스 본문

이것이 자바다/06 클래스

6.4 객체 생성과 클래스 변수 - 라이브러리와 실행 클래스

빌드이너프 2024. 4. 1. 17:33

클래스의 두 가지 용도

라이브러리(library) 클래스

: 실행할 수 없으며 다른 클래스에서 이용하는 클래스

실행 클래스

: main() 메소드를 가지고 있는 실행 가능한 클래스

 

라이브러리

package ch06.sec04;

public class Student {

}

 

실행 클래스

package ch06.sec04;

public class StudentExample {
	public static void main(String[] args) {
		Student s1 = new Student();
		System.out.println("s1 변수가 Student 객체를 참조");
		
		Student s2 = new Student();
		System.out.println("s2 변수가 Student 객체를 참조");
	}
}