06 December 2012

How java is platform independent?

In the classic sense of software development, programs are coded in higher level languages such as C/C++, then that source code needs to be compiled into native machine language specific to that platform so that the program is made executable. Java compiler on the other hand does not compile Java source files into native machine language, instead it compiles the source code into bytecodes. These bytecodes are platform independant i.e. in other words specific to to the Java Virtual Machine specification. This enables platform independant compilation. When the bytecode compiled programs are executed thru the Java interpeter, it converts those bytecodes into native machine code and executes them thru the JVM which is specific to host environment it is running on. This enables platform specific execution.

After compiling the ".java" file ,that will be converting into the ".class" file,which is a byte code having the capability run on any OS.Basing on the concept byte code java achieving the platform independent,it leads to "Write onece run anyware".

No comments :

Post a Comment

Popular Posts