
* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.
* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.
튜터님이 수업하신대로 따라했는데 뭐가 문제인지 잘 모르겠습니다.
required: java.lang.String,int,int
found: java.lang.String,int
reason: actual and formal argument lists differ in length
영상을 보면 이름과 나이만 적게 되있던데 이런 오류가 왜뜨는것일까요?
grandparent, parent, childrun 클래스에 속도는 숫자로 다 기입했습니다.
public class Java1_17 { //grandparent,parent,childrun,walkable,runnable,swimmablepublic static void main(String[] arg){
Human grandParent = new GrandParent("할아버지", 70);
Human parent = new Parent("엄마", 50);
Human child = new Childrun("나", 20);
Human[] humans = {grandParent, parent, child};
for (Human human : humans){
System.out.println(human.name + "나이" + human.age + ", 속도: " + human.speed+ ", 현재위치"+ human.getLocation());
}
System.out.println("<활동 시작>");
for (Human human : humans){
if (human instanceof Walkable) {
((Walkable) human).walk(1, 1); //캐스팅
System.out.println(" - - - - - -");
}
if (human instanceof Runnable){
((Runnable) human).run(2, 2);
System.out.println(" - - - - - -");
}
if (human instanceof Swimmable){
((Swimmable) human).swim(3, -1);
System.out.println(" - - - - - -");
}
}
}
}
