Program Internal


In this section we will demonstrate the internal functionality of the first program in Java the “Hello Java” program. We will learn that what is going on inside the Java program when it is run or when it is compiled.


Compilation time:

During the compilation of the program the file that is written in Java is compiled. This file during its compilation does not interact with the operating system and is converted into the Java byte codes.

Consider the following diagram in which we have explained that what happens when a program is compiled:


The above diagram shows that what happen during the compilation of the Java program. When the Java program is compiled it is converted into the Java byte code without getting interacted with the operating system. The extension of the byte code will be .class and with the name of the class that is used in the program.



During the runtime of the Java program the following steps are performed:


These points are explained below:


Class Loader:

The class loader is used to load the class files of the Java program. The class loader is considered to be as the subsystem of the JVM.

yle=”text-align: justify;”>Byte code verifier:

The byte code verifier is used to check the code to make sure that the code is not violating the access right to the objects. It prevents the illegal code.



The interpreter in Java is used to read the byte code stream. After reading the byte code stream the interpreter executes the instructions that are in the program to perform the specific task.

The users of Java can have the following questions in mind when the program is compiling and executing:

Q1. Can the Java file be saved by a name other than the name of the class?

The answer to this question is yes, the user can save a Java source file by a name other than the name of the class. This can only be done if the class in the Java program is public. Consider the following diagram:


To compile the above program we can use the following command:

Command to compile:


Command to execute:

java qwe

Therefore, we conclude that the source file of the java program can have a different name.

Q2. Can a Java program have a number of classes?

A Java program can have a multiple classes, consider the following diagram and you will understand that how a program in Java can have multiple classes.