Why Java is called as platform independent?
The process of converting the source code (.Java file) into byte code, that
byte code can run on any platform (machine) directly. It means that byte code
(.class file) is platform independent.
How java program works?
Fig. Program execution flow
CORE JAVA- HOW JAVA PROGRAM WORKS BY JEEVAN SIR 1
This diagram will show you in-detailed description.
-Java compiler will check syntax errors.
-Java interpreter will convert byte code into native code.
-After converting into native code or machine code, we will able to see the output
into the console.
Java Compiler
The process of converting entire source code into byte code with help of JVM that
process is known as java compiler.
It is the program that contains set of instruction which is implemented in C or C++
programming languages.
CORE JAVA- HOW JAVA PROGRAM WORKS BY JEEVAN SIR 2
Purpose-
It will just check your syntax errors or grammatical mistakes.
Java Interpreter
The process of converting byte code into native code that process is known as java
interpreter.
It is nothing but .exe file which is implemented in C or C++ programming
languages.
JIT Compiler (Just In Time)
The process of converting byte code into machine code only once known as JIT
compiler. It has more information like which classes has been loaded, which code
is executed frequently, elimination of method calls, etc.
CORE JAVA- HOW JAVA PROGRAM WORKS BY JEEVAN SIR 3