Home
Evaluating and watching expressions
When debugging, it is often useful to be evaluate an expression made up of several variables within the current application context.
To view the value of an expression within the code:
![]()
Select the expression (for example, balance.compareTo(amount) in the breakpoint line), right-click, and select Inspect. The result opens in a pop-up window showing the value (Figure | 4-9).
![]()
Figure 24-9 Inspect Pop-up window
![]()
To move the results to the Expressions view (Figure | 4-10) so that the value of the expression can continue to be monitored, press Ctrl+Shift+I.
![]()
To watch an expression, right-click in the Expressions view and select
Add Watch Expression. In the Add Watch Expression dialog, enter an expression, such as, balance.doubleValue().
![]()
Figure 24-10 Inspecting a variable in Expressions view
Note: The Expressions view contains a list of watched expressions (marked by a
symbol) and a list of inspected expressions marked by a a
symbol (Figure | 4-10). The difference between these is that the value shown for watched expressions changes with the underlying value as the user steps through the code, while an inspected expression will remain showing the value it held when it was first inspected.
ibm.com/redbooks