Java Reference
In-Depth Information
These changes indicate the current line in the execution path. Once the execution has
been paused, we can execute the code line-by-line in order to pin point exactly where
the problem is happening. There are two ways we can execute each line, we can either
step over the line, or step into it, the difference being when we step over, we will not
go "into" any method calls, simply going "over" the line. When we step into it, we
actually navigate inside any method calls that are being invoked in the current line.
In our example, stepping over the current line would skip the line that is actually
persisting the data, therefore the most appropriate course of action is to step into
the current line.
In NetBeans, we can step over the current line by pressing F7 or clicking on the icon:
Doing so will take us to the method being invoked in the current line, execution will
pause at this point, the next line to be executed will be highlighted in green and an
arrow will be placed next to it in the left margin.
Since there is only one executable line in this method, we know that stepping over
this line will cause the exception. We can inspect any local variables in the current
class and method by looking at the Local Variables window.
Search WWH ::

Custom Search