By Tony Bevis on Friday, 11 August 2023
Category: Java

Java programming course: 1.4 How programs are developed

 This is Lesson 1.4 of the Java programming course.

How Java programs are developed

Most programming languages use a specific set of commands that resemble English, but which must follow a prescriptive set of rules. By using commands that loosely resemble English it makes it easier for human programmers to give the computer the required instructions. These commands as written by the programmer is known as source code.

Because computers do not (yet) understand English, there needs to be some sort of translation into the language computers do understand, namely binary numbers. This translation is carried out by specially written "translation" programs which can be either (or both) of the following types:


Because interpreters translate and run on the fly, they tend to run more slowly than equivalent programs that were compiled. ​

​Compiling Java programs

Machine code is of necessity platform-specific (e.g., Windows, Linux, Max, different processors, etc.). Because one of the primary goals of Java is portability (i.e., platform independence), Java uses a modified version of the above approach which is summarised in these steps:

  1. The programmer writes the Java source code in the normal way. These source code files are typically given a file suffix of .java.
  2. The programmer invokes the compiler to create what is known as bytecode (this can be thought of as platform independent machine code). The bytecode is stored in a file with the same name as the source code except with a different file suffix, in this case .class
  3. The bytecode is delivered to the end user computer.
  4. The end user needs to already have a Java Virtual Machine (JVM) installed on their machine. They can then run the bytecode (which is interpreted by the JVM).

It can therefore be seen that Java programs are both compiled and interpreted.

There are separate JVMs for different platforms, but they are all capable of running the same compiled bytecode. It is this approach that gives Java its platform independence since the programmer only needs to develop, compile, and deliver one version of the program.

The next lesson will look at Java syntax and naming conventions.

Lesson 1.5 Java syntax and naming conventions

Related Posts

Leave Comments