System.out.print("X: "); scanner.nextLine(); //throw away the not consumed by nextInt() x = scanner.nextLine(); System.out.print("Y: "); y = scanner.nextLine();