//There is no specific way you can clear the scanner buffer but you can try this: Scanner scanner = new Scanner(System.in); scanner.nextLine();