This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
We all know that there are two steps of running a java program
 convert your .java file to bytecode using javac [called compilation] so you get .class file
 run your .class file using java [called interpretation] so you get your output.
I know that .java file is compiled only once using javac & we get .class file i.e bytecode i agree
Now when we want to run the file JRE which has java will run the file and give us the output.
now earlier days in java (may be in jdk1.1 or so) JRE used to interpret the byte code line by line and execute
which had one problem of performance compared to compiled languages like c & c++
so to solve that problem and improve performance now a days JRE includes apart from interpreter also one compiler called JIT(also called HotSpot Compiler) which compiles the byte code(instead of interpreting to native platform) hence improving performance.
first of all is my above understanding correct so far about JIT??
then i have a question?
this directly means that now a days a JRE is capable of both interpreting as well as compiling the byte code.
so question is how it will decide compile or interpret ?
Please s Note when i say compiling the byte code i do know we actually compile .java file ony once,i am not saying compiling .class file with javac again [its not possible] i am saying it in context of running the .class file.