傢伙的方法能不能幫我解釋一下最後2行請實現從接口的Java
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