Java Reference
In-Depth Information
When inspecting objects, you often need to give a command to Ȓopen upȓ the object,
for example by clicking on a tree node. Once the object is opened up, you see its
instance variables (see Figure 6 ).
Running to a breakpoint gets you there speedily, but you don't know how the program
got there. You can also step through the program a line at a time. Then you know how
the program flows, but it can take a long time to step through it. The single-step
command executes the current line and stops at the next program line. Most
debuggers have two single-step commands, one called step into, which steps inside
method calls, and one called step over, which skips over method calls.
The single-step command executes the program one line at a time.
For example, suppose the current line is
String input = in.next();
Word w = new Word(input);
int syllables = w.countSyllables();
System.out.println("Syllables in " + input + ": " +
syllables);
When you step over method calls, you get to the next line:
String input = in.next();
Word w = new Word(input);
int syllables = w.countSyllables();
System.out.println("Syllables in " + input + ": " +
syllables);
However, if you step into method calls, you enter the first line of the
countSyllables method.
public int countSyllables()
{
int count = 0;
int end = text.length() - 1;
. . .
}
Search WWH ::




Custom Search