The Rectangle object provides a number of methods for working with rectangles. The object's equals method determines whether two Rectangle objects are identical — that is, whether they have the same coordinates.
The inflateRect method increases or decreases the width or height of a rectangle, or both. It can add or remove width from both ends of the rectangle; it can add or remove height from both the top and bottom of the rectangle.
The overloaded contains method enables you to determine whether the area described by one rectangle exists within the area described by another, or to determine whether a given point exists within a rectangle.
The intersects and intersectsWith methods determine whether two Rectangle object’s intersect.