Java Program Internal

    Program Internal

    Once we write a Java program in the source code. The Java compiler converts the source code in the byte code that is platform-independent and can be run on any platform. We will discuss the working of compiling and running the Java program.

    What happens at compile-time?

    Java has a java compiler that converts the source code into the byte code, all this happens at the compile time. This byte code stored as the class file that is platform-independent and can be run on any system.

    What happens at the run-time?

    The class file that is generated after the code compilation will get loaded by the classloader. Classloader is the subsystem of the JVM. After the class file has been loaded it gets verified by the bytecode verifier to check for the illegal code that may violate the access rights. Then the interpreter read the bytecode stream to execute the instructions to provide the output. What happens at the run-time

    Points to remember

    1. You can save the code with any name other than the class name. When you compile the code, the .class file with the class name is created. So when you execute the compiled file that will be with the name of class file. Suppose you save the code with with class name as a bye. Javac -> compiler -> bye.class -> java bye 2. You can have any number of classes within your source code.


    During the compilation of a Java program, the Java compiler converts the Java program into bytecode. This bytecode is stored as a class file, which is platform-independent. At runtime, Java Virtual Machine (JVM) converts that bytecode into machine code. Every Java program follows this process. We hope this article has provided you with enough clarity on the working of Java programs. People are also reading: