Example: Evaluating a Condition in the Integrated
Debugger
To see how to evaluate an expression in an if-statement condition without the program
actually starting the statement, do the following steps:
- If the Hanoi Sample package has not yet been added from the repository to the workspace,
add the package com.ibm.ivj.examples.hanoi from the IBM Java Examples project.
- Go to the method com.ibm.ivj.examples.hanoi.Hanoi.solve(int,Post,Post,Post).
- Set a breakpoint by double-clicking on the margin next to the following line:
if (depth == 1)
- Run the Hanoi application.
- When the Debugger browser opens, select the solve(int,Post,Post,Post) method in the All
Programs/Threads pane.
- In the Source pane, select the text depth == 1. Click the Inspect
button
. An
Inspector window will open, and the Value pane will display "false"
(assuming the number of disks you started with was greater than 1).
- In the Source pane, select the next if condition, depth > 1.
Select Display from the selected text's pop-up menu.
The text "(boolean) true" will be inserted in the Source
pane. Press Delete to remove the inserted message.
Click the Terminate button
to terminate the program.
