Hi Amit,
In
java running & executing a program is two step process. The first step is compilation & then it is interpretation.
After we write a program (source code with ext filename.java) , we write javac <filename.java>. This step is the compilation part. The compilation basically checks for language errors or syntax errors. There are certain rules that java follows, for ex, each statement should end with semicolon, the syntax of for loop etc. When a program is successfully compiled, the compiler says something like ... okay this source code is according to the java rules. When a program is compiled, it creates a .class file or more precisely byte code
The second part is the interpretation part. Now this bytecode is executable by any machine that has a JRE or JVM. The byte code, is a code that is independent of all the systems. So any device/pc capable of executing java can execute the above byte code. The JVM is basically the virtual machine within an physical machine. The JVM basically interprets the byte code / class file to execute the program.
The above two parts is quite a power ful due to the fact that the above process makes java platform independent. It is due to the fact that the java code is execuited by the virtual machine rather than the phycial machine.
I am not sure whether how successful i was in solving your query...
SCJP 1.4, SCWCD 1.4, SCBCD 1.5, TOGAF 9, Comptia Cloud+