오버로딩 (Overloading)
메소드 이름은 같지만 다른 매개변수의 개수, 데이터 타입, 순서를 가지는 것 반환 형태만 다른 메소드들은 오버로딩에 해당되지 않음 void A (int arg1) {} int A (int arg1) {} // 리턴 타입만 다를 경우, 어떤 메소드를 호출해야 하는지 알 수 없기 때문에 에러가 발생함 this를 사용해서 오버로딩 된 메소드들의 중복을 줄일 수 있음 public void setOperands(int left, int right) { this.left = left; this.right = right; } public void setOperands(int left, int right, int third) { this.setOperands(left, right) this.third = third; }