728x90
public class Ex13 {
public static void main(String[] ags){
FireCar firecar = new FireCar();
if(firecar instanceof FireCar)
System.out.println("FireCar");
if(firecar instanceof Car)
System.out.println("Car");
if(firecar instanceof Object)
System.out.println("Object");
}
}
728x90
'JAVA > 예제' 카테고리의 다른 글
[JAVA] ch07-15. 객체 지향 15 (0) | 2017.08.22 |
---|---|
[JAVA] ch07-14. 객체 지향 14 (0) | 2017.08.22 |
[JAVA] ch07-11. 객체 지향 11 (0) | 2017.08.22 |
[JAVA] ch07-10. 싱글톤 기법 (singleton) (0) | 2017.08.22 |
[JAVA] ch07-09. 객체 지향 9 (0) | 2017.08.22 |
댓글