/* package whatever; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
public static void main
(String[] args
) {
SonicAirplane sa = new SonicAirplane();
sa.takeOff();
sa.fly();
sa.flyMode = SonicAirplane.SONIC;
sa.fly();
sa.flyMode = SonicAirplane.NORMAL;
sa.fly();
sa.land();
}
}
//일반적인 비행기를 나타낸 클래스- 공통
class Airplane{
public void land(){
}
public void fly(){
System.
out.
println("일반모드로 비행합니다"); }
public void takeOff(){
}
}
//음속 비행기를 나타낸 클래스 - 상속
class SonicAirplane extends Airplane{
public static final int NORMAL = 1;
public static final int SONIC = 2;
//비행 모드를 저장하는 변수
public int flyMode = NORMAL;
@Override
public void fly(){
if(flyMode==SONIC){
System.
out.
println("음속모드로 비행합니다"); }else{
//부모인 Airplane 객체의 fly() 메소드 호출
super.fly();
}
}
}
LyogcGFja2FnZSB3aGF0ZXZlcjsgLy8gZG9uJ3QgcGxhY2UgcGFja2FnZSBuYW1lISAqLwogCmltcG9ydCBqYXZhLnV0aWwuKjsKaW1wb3J0IGphdmEubGFuZy4qOwppbXBvcnQgamF2YS5pby4qOwogCi8qIE5hbWUgb2YgdGhlIGNsYXNzIGhhcyB0byBiZSAiTWFpbiIgb25seSBpZiB0aGUgY2xhc3MgaXMgcHVibGljLiAqLwpjbGFzcyBJZGVvbmUKewoJcHVibGljIHN0YXRpYyB2b2lkIG1haW4gKFN0cmluZ1tdIGFyZ3MpCgl7CgkJU29uaWNBaXJwbGFuZSBzYSA9IG5ldyBTb25pY0FpcnBsYW5lKCk7CgkJc2EudGFrZU9mZigpOwoJCXNhLmZseSgpOwoJCXNhLmZseU1vZGUgPSBTb25pY0FpcnBsYW5lLlNPTklDOwoJCXNhLmZseSgpOwoJCXNhLmZseU1vZGUgPSBTb25pY0FpcnBsYW5lLk5PUk1BTDsKCQlzYS5mbHkoKTsKCQlzYS5sYW5kKCk7Cgl9Cn0KIAovL+ydvOuwmOyggeyduCDruYTt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