O'Reilly logo

Java™ How to Program, Seventh Edition by P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Q.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 will 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 have followed Step 1 and Step 2 in Section Q.2 to open the Command Prompt, change to the correct examples directory and compile classes AccountTest and Account for debugging (i.e., with the -g compiler option).

1.
Starting the debugger. Start the debugger by typing jdb.
2.
Watching a class’s field. Set a watch on Account’s balance field by typing ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required