Hi i need some help to implement the limit of characters one can type. It should show an error msg that the user cannot input more than 2 characters in x coordinate and y coordinate. How should i do that?
import java.util.Scanner;
public class P1
{
public static void main(String[]args)
{
int xaxis,yaxis;
Scanner sc= new Scanner(System.in);
System.out.println("Enter the X Coordinates:");
xaxis = sc.nextInt();
System.out.println("Enter the Y Coordinates:");
yaxis = sc.nextInt();
if(xaxis >=0 && yaxis >=0)
System.out.println("Q1");
else if(xaxis < 0 && yaxis >=0)
System.out.println("Q2");
}
}

