I do get the the task to work with BufferedReader and tried to make it work with scanner but tried many things but keep getting ExceptionInputMismatch. Can someone please explain where I go wrong? Scanner scanner = new Scanner(System.in); HashMap<String, Integer> map = new HashMap<>(); do { int number = scanner.nextInt(); String name = scanner.nextLine(); map.put(name, number); } while (!scanner.hasNextInt());