When you throw your exception, you go back to the beginning of your do while loop because that’s where your try block starts. If you don’t want to reset your loop in an exception, put a try catch block within your for loop.
0
solved For loop resets after an exception