Small Java Programs
This chapter discusses naming and coding conventions as well as reserved words in Java. When you go through this chapter, you'll get some hands-on experience with writing in Java.
10. Edit, Compile, and Run Cycle
You would compile the old, uncorrected version of the source file on hard disk and get the same error message.
When you use a text editor you change the source program that is in main memory.
If you don't save your changes, the file on disk does not change. The compiler
javacuses the file that is
currently on the hard disk.
This is a common mistake.
Edit, Compile, and Run Cycle
Until your program runs correctly:
- Edit the program (the source file).
- Save the program to the hard disk with the "Save" or "Save As" command of the editor.
- Compile the program with the
- If there are syntax errors, go back to step 1.
- Run the program with the
- If there are bugs, go back to step 1.
- 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 Eclipse or BlueJ is more sophisticated, but you still go through the same fundamental cycle.
If a source program compiles correctly in step 3, does that mean that it will run correctly?