Setting Breakpoints in Code
A breakpoint is a flag in the source code that tells the debugger to stop execution of the program. When your program stops on a breakpoint, you can perform actions such as examining the values of variables and single-stepping through your program.
The IDE enables you to set several types of breakpoints using the New Breakpoint dialog. Breakpoints can be set using the New Breakpoint dialog for the following types of source elements:
- Class
- You can break when the class is loaded into the virtual machine, unloaded from the virtual machine, or both.
- Exception
- You can break whenever a specific exception is caught, whenever a specific exception is not handled in the source code, or whenever any exception is encountered regardless of whether the program handles the error or not.
- Field
- You can stop execution of your program whenever a field in a specific class is accessed (for example, the method was called with the variable as an argument), modified or both.
- Method
- Program execution stops every time the method is entered, exited or both.
- Thread
- You can break program execution whenever a thread starts, stops, or both.