We will be writing the code in the notepad/Edit plus which is also called as source file which will be in the human readable format & save the file with .java extension.
Once after saving, to convert into machine readable format, need to perform two operations: Compilation(javac) & Interpretation(java).
The compiler will receive .java file as an input & generates .class file. The compiler will check for the following: Syntax ,Rules and translates from .java file to .class file.
.class file is a byte code which is also called as Intermediate code which cannot be read by human nor machine. This .class file will be given as an input to the interpreter which will generate the binary code & given as an input to the Operating system, O.S will perform the operation & gives the output.
Now Let us see about JDK, JRE, JVM & JIT:
What is JDK?
JDK stands for Java Development Kit. It is a development kit which has all the utilities & the library files to develop a java software.
What is JRE?
JRE stands for Java Runtime Environment. It is an environmental setup which is provided to run the java program. Since, JRE is installed in each & every electronic device, the .class file can be executed on any device. Hence, Java is called as platform independent language.
What is JVM?
JVM stands for Java Virtual Machine. It is a virtual machine which doesn’t exist physically & it is whole responsible to execute the java program.
What is JIT?
JIT stands for Just In Time.
JIT converts .file to binary format. The interpreter does the following:
- Reads line by line
- executes
- translates form .class file to binary format.
The program might be syntactically correct, if it is an abnormal statement like 1/0, it will throw Run Time Error/Exception(RTE).
All the Java programs will execute line by line from left to right.
Thanks for reading this article!!!
Hope you liked!!!