Thursday, 2 October 2014

Plantform Independent Java

How Java Achives Platform Independance.


Why  Java is known for Platform Independance.


Quick Note about the Platform Independance (Portability) Feature of Java Language.


          The most important feature of Java is its portability. A program created in one platform has the ability to run on another.

C/C++

          Eg: When we create a C/C++ program in Windows Operating System, it doesn't have the ability to run in a system which runs on Linux Operating System. 
Platform Dependence of C/C++
The main reason behind this is, C/C++ code takes a few components from its Operating System to run the generated code. So the platform change affects the execution of the program. 

Java

Plantform Independence of Java
Java overcomes the platform independence with the help of Java Virtual Machine (JVM). Java creates a layer between the language and the Operating System. The layer is called Virtual Machine (JVM). There are different Virtual Machines for different Operating Systems as JVM dependent on the Operating System. We need to install the Java Virtual Machine compatible for each Operating System for all devices. Java run on top of this Virtual Machine and make the portability easier. 

        The compilation of Java program makes a class file which contains the bytecode. The bytecode is same for all Operating System and just the JVM deals with it in all Platforms. 



No comments:

Post a Comment