2011-10-15 5 views
0

녀석의 메소드를 구현 당신이 날 마지막 두 라인이 인터페이스 자바

MenBook mbobject = (MenBook) other

가 그 mbobject 클래스 Menbook의 목적은 의미합니까 제발 설명 할 수 있을까? 기타는 무엇을 의미합니까?
public boolean moreExpensiveThan(Object other) { 
    If(other == null) 
    return false; 
    else if (getClass() != other.getClass()) 
    return false; 
    else { MenBook mbobject = (MenBook) other; 
     return (sellingPrice() >= mbobject.sellingPrice()); 
     } 

OrderedByPrice is an interface

답변

1

당신은 (유형 MenBook의) 변수 mobject에 할당되어 있습니다 other (유형 Object의) 객체, 그 형태가 올바른 (getClass() != other.getClass())의 것을 확인 후.

0

mbObject이라는 새 MenBook 개체를 만들고 other이라는 개체를 할당합니다.

other 앞의 (MenBook)

개체가 MenBook 객체에 other 라고 주조 의미합니다.