Is the JVM a compiler or an interpreter?
First, let's have a clear idea of the following terms
Javacis Java Compiler -- Compiles your Java code into Bytecode
JVMis Java Virtual Machine -- Runs/ Interprets/ translates Bytecode into Native Machine Code
JITis Just In Time Compiler -- Compiles the given bytecode instruction sequence to machine code at run-time before executing it natively. It's main purpose is to do heavy optimizations in performance.
So now, Let's find answers to your questions..
JVM: is it a compiler or an interpreter?-- Ans: Interpreter
what about JIT compiler that exist inside the JVM?-- Ans: If you read this reply completely, you probably know it now
what exactly is the JVM?-- Ans:
- JVM is a virtual platform that resides on your RAM
- Its component, Class loader loads the
.classfile into the RAM
- The Byte code Verifier component in JVM checks if there are any access restriction violations in your code. (This is one of the principle reasons why java is secure)
- Next, the Execution Engine component converts the Bytecode into executable machine code
Post a Comment