- The Following Code Is Used To Implement The Compare To Method In The Comparablerectangle Class This Method Returns 1 If 1 (51 KiB) Viewed 49 times
The following code is used to implement the compare To method in the ComparableRectangle class. This method returns 1 if
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
The following code is used to implement the compare To method in the ComparableRectangle class. This method returns 1 if
The following code is used to implement the compare To method in the ComparableRectangle class. This method returns 1 if the calling object has a greater area than the passed in object, -1 if the calling object has a lesser area than the passed in object, and 0 if the objects have equal areas. public int compare To (ComparableRectangle o) { if (getArea() } return ;; else if (getArea() return else return ; o.getArea() o.getArea()