C
Chad
Let's say I have the following class.....
public class ComparableRectangle extends Rectangle implements
Comparable {
public ComparableRectangle(double width, double height) {
super(width, height);
}
public int compareTo(Object o) {
if (getArea() > ((ComparableRectangle)o).getArea())
return 1;
else if (getArea() < ((ComparableRectangle)o).getArea())
return -1;
else
return 0;
}
}
Are 'width' and 'height' data fields in this class? My initial guess
is yes. However, the fact that they are passed to super() makes me
wonder otherwise.
Chad
public class ComparableRectangle extends Rectangle implements
Comparable {
public ComparableRectangle(double width, double height) {
super(width, height);
}
public int compareTo(Object o) {
if (getArea() > ((ComparableRectangle)o).getArea())
return 1;
else if (getArea() < ((ComparableRectangle)o).getArea())
return -1;
else
return 0;
}
}
Are 'width' and 'height' data fields in this class? My initial guess
is yes. However, the fact that they are passed to super() makes me
wonder otherwise.
Chad