커뮤니티
포인트
쿠폰
내 강의실
국비 신청 내역
증명서
계정
로그아웃
학습 질문
개발 일지
나의 활동
답변 완료
1-17 수업 에러
undefined주차
북마크
한*윤
댓글
5
추천
0
조회수
22
조회수
22
답변 완료

* 겪고 있는 문제 상황을 최대한 자세하게 작성해주세요.

* 문제 해결을 위해 어떤 시도를 해보았는지 구체적으로 함께 알려주세요.


튜터님이 수업하신대로 따라했는데 뭐가 문제인지 잘 모르겠습니다.

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(" - - - - - -");
            }
        }
    }
}

  • constructor GrandParent in class GrandParent cannot be applied to given types; required: java.lang.String,int,int found: java.lang.String,int reason: actual and formal argument lists differ in length 
  • constructor Parent in class Parent cannot be applied to given types; required: java.lang.String,int,int found: java.lang.String,int reason: actual and formal argument lists differ in length 
  • constructor Childrun in class Childrun cannot be applied to given types; required: java.lang.String,int,int found: java.lang.String,int reason: actual and formal argument lists differ in length 



취소
 공유
취소
댓글 0
댓글 알림
나의얼굴