In this tutorial, We will learn about How JVM works internally in Java language.
A program written in a high-level language is known as a source program or source code.
A source program must be translated into machine code for execution as a computer cannot understand a source program.
The computer can only execute the code in binary form.
The translation can be done using another programming tool called an interpreter or compiler.
A compiler translates the entire source code into a machine code file or an intermediate code. Then, that file is executed.
An interpreter reads a statement from source code, translates it to the machine code or virtual machine code and then executes it right away.
First, we can write a Java program using Java language in a text editor. Java source code will be saved with the extension is – .java Then, we can use a Java compiler to compile the codes to get the Java bytecode. This Java bytecode can have the .class extension. Java bytecode is the modified version of the Java source code. And then we can pass this Java bytecode to Java virtual machine (JVM) which is an interpreter. It reads one statement at a time from this Java bytecode. Then, it converts that machine level code and executes that code. This is repeated until all codes are executed. Finally, an output is available after the execution of the program.
Execute of same codes in different platforms.
We can execute our code in windows, and also we can execute our code in mac or Linux or other o/s.
Java contains a special package JVM(Java virtual machine) which executes our Java bytecode. Java provides the specific platform for JVM. If you use windows platform, then you must have windows specific JVM. If you have used Linux platform, then you must have Linux specific JVM. All these platform-specific JVM are capable of executing the Java bytecode in the same way. So Java program is capable of running on different platforms.
Suggested for you
Feature of Java programming language
How to find reverse number using method In this article, we will discuss the concept…
C# inverted full pyramid star pattern In this article, we will discuss the concept of…
C# Full Pyramid star pattern program In this article, we will discuss the concept of…
Program to count vowels, consonants, words, characters and space in Java In this article, we…
How to print multiplication table using Array in C++ language In this post, we will…
C Program to multiplication table using Array In this tutorial , we will discuss about…