At line 13 the code called nextInt() which read invalid data from the console. The nextInt() method wants numeric input. Make sure the user enters valid input.