i'm trying to print out the invalid input entered by a user, but am running in to problems if they enter some long text containing spaces a second time ..... it requires enter key to be pressed twice before the error message is printed. Below is code i have done for it any idea how to fix it?
private Scanner input;
input = new Scanner(System.in);
while (!input.hasNextInt()) {
System.out.println("[ERROR] Invalid entry!" + input.nextLine()
+ "\n Please enter a valid Menu Option number ");
input.nextLine();
}