Others examined how to use System.in.readLine() so that the program explicitly required action from the user.
If you need the program to not expect the user, but let you, the programmer, slow down the program so that you can find and fix the error, you may want to use a debugger, because this is exactly what it is intended for.
Every modern Java IDE has a debugger. The keys selected to use it simply change.
If you use Eclipse, you use F11 or Ctrl-F11 to run your program (assuming that Windows). The difference is that F11 runs your program inside the debugger, but Ctrl-F11 does not.
Place the cursor on the first line inside the for loop and select Run-> Toggle Breakpoint. A blue bullet will appear to the left of the line. This indicates that the breakpoint is active - the debugger now stops your program every time it reaches this line.
Now run your program in the debugger using F11. The program stops at the line, and you can examine your variables in the Variables panel as needed and continue execution with F8 whenever you are ready.
source share