Home » Core Java » how is Java Platform independent ?

how is Java Platform independent ?

 

Most programming languages use compilers to translate high level program to machine code of the OS in a single step. Machine code is platform dependent.So,once the machine code is generated we cannot port it to a different OS.Therefore, any language that uses just the compiler to compile as well as execute the program is platform dependent.

 

Java Platform Independent :

In Java,  compiler is divided into two different programs as compiler and interpreter.Java uses compiler to translate high level Java code into bytecode, and uses the interpreter(JVM-Java Virtual Machine) to translate bytecode to machine code. This is two step process.This byte code is platform independent and can be ported across any OS.So in a particular OS ,if you install OS specific JDK ,the interpreter JVM in that OS converts the bytecode to machine code of that OS.

 

 


Leave a comment

Your email address will not be published. Required fields are marked *

1 × three =