Pages

JVM is platform independent or dependent?What is JVM and how its converts byte code into machine code?

Is the JVM is platform independent or dependent?


Ans: JVM is platform dependent.



What is JVM and how its converts byte code into machine code?
·JVM is Software from Sun that converts a program in Java from byte code (intermediate language) into machine language and executes it. The Java Virtual Machine (JVM) is the runtime engine of the Java Platform, which allows any program written in Java or other language compiled into Java byte code to run on any computer that has a native JVM. JVMs run in both clients and servers, and the Web browser can activate the JVM when it encounters a Java applet.

·The JVM includes a just-in-time (JIT) compiler that converts the byte code into machine language so that it runs as fast as a native executable. The compiled program can be cached in the computer for reuse.

·JVM is an interpreter and it converts .class (dot class) file code into operating system code.

·JVM converts .class file code line by line and executes line by line.

·If 1st line of .class file code is converted into operating system code then it is executed at that time.

·Similarly for second, third and fourh …………… nth lines its process should be the same.