E.5 The watch Command
In this section, we present the watch command, which tells the debugger to watch a field. When that field is about to change, the debugger will notify you. In this section, you’ll learn how to use the watch command to see how the Account object’s field balance is modified during the execution of the AccountTest application.
As in the preceding two sections, we assume that you’ve followed Step 1 and Step 2 in Section E.2 to open the command window, change to the correct examples directory and compile classes AccountTest and Account for debugging (i.e., with the -g compiler option).
-
Starting the debugger. Start the debugger by typing
jdb. -
Watching a class’s field. Set a watch on
Account’sbalancefield by typingwatch ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access