E.3 The print
and set
Commands
In the preceding section, you learned how to use the debugger’s print
command to examine the value of a variable during program execution. In this section, you’ll learn how to use the print
command to examine the value of more complex expressions. You’ll also learn the set
command, which allows the programmer to assign new values to variables.
For this section, we assume that you’ve followed Step 1 and Step 2 in Section E.2 to open the command window, change to the directory containing the Appendix E examples (e.g., C:\examples\appE
) and compile the AccountTest
application (and class Account
) for debugging.
Starting debugging. In the command window, type
jdb
to start the Java debugger.Inserting a breakpoint. ...
Get Java How To Program, Late Objects, 11th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.