Java Program to Check if Point Lies in Rectangle
public class Main
{
public static void main(String[] args)
{
int x1 = 0;
int y1 = 0;
int x2 = 10;
int y2 = 8;
int x = 1;
int y = 5;
if ( (x > x1 && x < x2) && (y > y1 && y < y2))
System.out.println("points P lies inside the rectangle");
else
System.out.println("points P doesn’t lie inside the rectangle");
}
}
Output:
points P lies inside the rectangle
