You can use the NetBeans debugger to inspect the contents of variables while
the program is running. Here you will look at how the contents of
the age variable changes.
Find the two lines:
age++;
JOptionPane.showMessageDialog(null, "Next year, you'll be " + age);
and click on their line numbers in the left margin. The line numbers
will be replaced by small pink boxes representing breakpoints.
Click Debug on the menu bar and select Debug Project (Lab1).
The program will prompt for an age (enter 45, say) and run normally
until it encounters a breakpoint, where it will stop and allow you to
observe the state of the computation.
Click on the Variables tab near the bottom to observe the
contents of program variables. The age variable should contain 45.
Click Debug on the menu bar and select Continue. The
program will proceed to the next breakpoint and update the contents of the
variables. The age variable should now contain 46.
Continue the program to completion. You can remove breakpoints by
clicking on the small pink boxes.