import java.awt.Rectangle;
public class PointInRectangle {
public static void main(String[] args) {
// Define the rectangle
Rectangle rectangle = new Rectangle(10, 10, 60, 60); // x=10, y=10, width=60, height=60
// Define the point
int pointX = 30;
int pointY = 20;
// Check if the point is inside the rectangle
boolean isInside = rectangle.contains(pointX, pointY);
if (isInside) {
System.out.println("The point (" + pointX + ", " + pointY + ") is inside the rectangle.");
} else {
System.out.println("The point (" + pointX + ", " + pointY + ") is outside the rectangle.");
}
}
}
/*
run:
The point (30, 20) is inside the rectangle.
*/