CHAPTER 11 ■ DEBUGGING WITH ECLIPSE
Let's see what happens when we run the program (Figure 11-4).
Figure 11-4. Execution suspended at breakpoint:
Notice the line highlighted in green. That green line indicates the current execution point (that is,
the line that was being processed before the program was suspended). When the debugger stops at a
line, it shows you the values in scope for that line in the Variables list, the method containing the line in
the Outline panel, and the call stack in the Debug panel. From there, you can step through the code,
either one line at a time or even within a line. We'll get to stepping shortly. First, though, let's be sure you
understand the concept of scope.
About Scope
What does “in scope” mean? The objects and primitives (that is, the variables) that are in scope are those
that are capable of being used at a particular point in the program. In the case of the breakpoint above,
the only local value we can see is g, the instance of the Graphics class that will be used for the drawing.
However, we can also see a value called this, which is the containing class. By expanding the this entry
in the variable list, we can see all the class variables declared within it (rather than in a method). Figure
11-5 displays what an expanded view of the this value looks like.