Add the following method to your Rectangle class: public Rectangle intersection(Rectangle rect) Returns a new Rectangle that

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 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.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: