Edit, Compile, Run Cycle

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.

Answer:

You will compile the old, uncorrected version of the source file and get the same error message. When you are using Notepad (or any other text editor) you are changing the version of the source program that is in main memory. The compiler javac uses the file that is saved on the hard disk.

Edit, Compile, Run Cycle

This is what you will do until your program is running correctly:

  1. Edit the program using Notepad.
  2. Save the program to the hard disk with the "Save" or "Save As" command in Notepad.
  3. Compile the program with the javac command.
  4. If there are syntax errors, go back to step 1.
  5. Run the program with the java command.
  6. If it does not run correctly, go back to step 1.
  7. When it runs correctly, quit.

This is called the "edit-compile-and-run" cycle. Expect to go through it many times per program. A Java development environment like Symantec Café is more sophisticated but the same fundamental activities are going on underneath.

QUESTION 8:

If a source program compiles correctly in step 3, does that mean that it will run correctly?