Java/6. 클래스 (Class)

Day 8 : import문

pancakemaker 2021. 10. 28. 15:13

import문

package sec12.exam03_import.mycompany;

import sec12.exam03_import.hankook.SnowTire;
import sec12.exam03_import.hyundai.Engine;
import sec12.exam03_import.kumho.BigWidthTire;

public class Car {
	//필드
	Engine engine = new Engine(); //인스턴스 생성시 import 필요 : Source 메뉴 -> Organize imports
	SnowTire tire1 = new SnowTire();
	BigWidthTire tire2 = new BigWidthTire(); //Ctrl+Shift+O : import 단축키
	sec12.exam03_import.hankook.Tire tire3 = new sec12.exam03_import.hankook.Tire();
	sec12.exam03_import.kumho.Tire tire4 = new sec12.exam03_import.kumho.Tire(); 
	//hankook, kumho 패키지에 모두 Tire 클래스가 있어 구분을 위해 경로를 명시해줌 (import 대신)
}