Java Reference
In-Depth Information
Tutorial: Debugging
We'll use the Debug perspective to look at what is going on within the calculation.
1.
In the fedTaxCalc source code, define the taxSal calculation statement as a breakpoint by
double-clicking the marker bar (the vertical light blue area to the left of the line numbers)
next to the taxSal calculation line number.
A blue circle (indicated by the arrow in Figure 6-7 ) will be placed in the marker bar to indicate a breakpoint has
been defined for the statement.
Figure 6-7.
2.
To open the Debug perspective, click on the Debug button (the button with the bug icon,
to the left of the Run button), and answer yes to the Confirm Perspective Switch prompt.
The Debug perspective will be displayed (see Figure 6-8 ). To start finding the problem, the programmer first
determines if the processing (up to the breakpoint) was correct. By examining the variable values, the programmer
can usually determine if the processing was correct. (Fortunately, variable values are easily displayed in the Debug
perspective.) If the processing was not correct, then the programmer has narrowed down where the problem lies
(e.g., the statements before the breakpoint probably contain the error(s)). If the processing was correct, then the
statements after the breakpoint probably contain the error(s).
 
Search WWH ::




Custom Search