Question: Add the following method to your Rectangle class: public Rectangle intersection(Rectangle rect) Returns a new Rectangle that represents the largest rectangular region completely contained within
Add the following method to your Rectangle class:
public Rectangle intersection(Rectangle rect)
Returns a new Rectangle that represents the largest rectangular region completely contained within both this Rectangle and the given other Rectangle. If the Rectangles do not intersect at all, returns a Rectangle with width and height both equal to 0.
Step by Step Solution
3.30 Rating (153 Votes )
There are 3 Steps involved in it
Returns a new rectangle that represents the largest re... View full answer
Get step-by-step solutions from verified subject matter experts
