Skip to main content
Lesson 1 - Introduction to Object Oriented Programming
ZIPPDF (letter)
Lesson MenuPreviousNext
  
Compiling and Running a Program page 6 of 8

  1. A programmer writes the text of a program using a software program called an editor. The text of a program in a particular programming language is referred to as source code, or simply source. The source code is stored in a file called the source file. For example in the DrawSquare example given above, source program would be created and saved in a file named DrawSquare.java.

  2. Compiling is the process of converting a program written in a high-level language into the bytecode language the Java interpreter understands. A Java compiler will generate a bytecode file from a source file if there are no errors in the source file. In the case of DrawSquare, the source statements in the DrawSquare.java source file would be compiled to generate the bytecode file DrawSquare.class.

    Figure 1.5 - From Source Code to Running Program

  3. Errors detected by the compiler are called compilation errors. Compilation errors are actually the easiest type of errors to correct. Most compilation errors are due to the violation of syntax rules.

  4. The Java interpreter will process the bytecode file and execute the instructions in it.

  5. If an error occurs while running the program, the interpreter will catch it and stop its execution. Errors detected by the interpreter are called run-time errors.

    Figure 1.6 - Edit-Compile-Run Cycle for a Java Program


Lesson MenuPreviousNext
Contact
 ©ICT 2003, All Rights Reserved.