Articles

Why Java is Platform Independent?

by Essay Corp Online Writing Services
Java is an object oriented general purpose programming language and computing platform for developing application. It is similar to C++ but a bit advanced. Java can be downloaded freely and can also be accessed freely. Java was developed by James Gosling with his team members Mike Sheridan and Patrick Naughton. It was developed for Sun Microsystems Company in 1995.It was later conquered by Oracle Corporation.
Java is Concurrent i.e. it can execute many statement at once instead of executing them sequentially. Java is class based and object oriented programming language. It is a platform independent language i.e. the compiled code can be run on any java supporting platform. It runs on the logic of “Write once, run anywhere”.
The platform that helps to run and develop the programs written in java script is called java platform. Java platform consists of execution engine, a compiler, and a set of libraries. Java programs can run on any OS or processor.
Why is JAVA a platform independent language?
Java compiler produces a unique type of code called bytecode unlike c compiler where compiler produces only natively executable code for a particular machine.
When the Java program runs in a particular machine it is sent to java compiler, which converts this code into intermediate code called bytecode. This bytecode is sent to Java virtual machine (JVM) which resides in the RAM of any operating system. JVM recognizes the platform it is on and converts the bytecodes into native machine code. Hence java is called platform independent language.
Detailed Explanation:
First, let’s have a look at how programs are written and executed, how they are executed in C/C++, what is bytecode and native code and finally how java program is executed.
Generally a program will be written in a high level language (i.e. human readable language) which consists of many phrases, words etc that cannot be understood by a machine. Hence it should be converted into machine level language. This work is done by the compiler. The compiler is a program that converts the code from High level language (programming language) to machine level language (Executable code). This executable code can be a sequence of instructions which is directly executed by CPU or can be sent to intermediate Virtual Machine.
When a program is written and compiled in C/C++ language, the code is directly converted into machine readable language .i.e. executable code. This code is generated as .exe file. This generated .exe file can run only on specific operating system. i.e. when the program is compiled in windows OS .exe file can run only in windows OS and not on Unix OS.
Therefore C/C++ programs are said to be platform dependent. The generated .exe files are called as native codes. Native codes are the machine codes that are understood by the machines. For the particular program native code generated is different for each OS. The native code generated by Windows OS differs from native code generated by Unix OS.


Sponsor Ads


About Essay Corp Advanced   Online Writing Services

94 connections, 7 recommendations, 388 honor points.
Joined APSense since, January 12th, 2019, From Tucson, United States.

Created on Jun 4th 2019 07:07. Viewed 427 times.

Comments

No comment, be the first to comment.
Please sign in before you comment.