Enter an integer: -5 The number -5 is negative Good-bye for now
Only the true-branch was executed because the answer to the
question num < 0
was true.
Here is a simulation of this program (using JavaScript and your browser). Of course, for maximum benifit you should "copy-paste-save-and-run" the real program. But, play with the following if you want. Perform the steps 1, 2, and 3 under the simulated monitor as many times as you want. (Note: if this does not work, your browser does not have JavaScript enabled. Skip this and go on to the next page.)
This is just a simulation (using JavaScript), so it is not exactly like a compiling and running a real Java program. Don't take it too seriously. Please do the real thing if you can.