Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

Why java is platform independent?

user-image
Question added by Mohammad Adnan Ali
Date Posted: 2015/04/29
سعد رضا ٰ
by سعد رضا ٰ , Software Engnieering , None

First of all, a platform is anything on which a program is run(in lay man term). A platform is either the machine itself, or a primitive kernel or a fully developed OS. Languages can be platform dependent or independent.

Dependent means its executable code and source code varies from platform to platform. That is to say that the programmer has to make some changes in the code if it has to run on other platforms. Languages like C are platform dependent.

Platform independent means that the code remains the same irrespective of the platform involved. Java has something called a virtual machine called JVM or Java Virtual Machine. What happens in case of Java is that the JVM once installed on any platform like windows or OS X can run the java code without any alteration. The JVM acts like a virtual platform on which the code is executed. As the platform being JVM remains constant throughout all platforms Java programs can run on any platform irrespective of the real platform. 

If you want to know the detailed process then it is here: Java source code written in the high level java is first converted to something called the javabyte code. This byte code is not readable by the original platform, but only the JVM can read it and then it executes it. This is the primary reason why Java is much in use even today.

 

http://functionspace.org/topic/1689/Why-is-java--called-a-platform-independent-language-

Mohd shahnawaz khan
by Mohd shahnawaz khan , Associate Project , Cognizant Technology Solution

First of u should know  what is java ?

Java is a technology or architecture which provides  :-

Language 

Platform

Secondly You should know what is platform ?

Platform is a program which provides runtime environment to application.

Runtime  environment involves memory management , process management , device management

and I/O management . example -> Operating system , Java

 

Thirdly what is  platform independent ?

In this approach an application designed on a machine can be carried and  executed on any machine . This is because it generates intermediate code.

 

Now the actual question why java is platform independent ?

Java produces intermediate code which is platform independent but the platform provided by java

is dependent (i,e  JVM).

 

 

A languagge / Technology is said Platform Indepedet if and only if ,if those languages supported by each and every operating System .

For ex:-

If you Devlop any project on C,C++ you need to be excute on your own System becoz c,c++ languages Platform Dependent

coming to Java you can excute on every Operating System..

 

Muhammad Iqbal
by Muhammad Iqbal , Java Engineer , Celerant Technology

because that is what the creators of Java wanted to achieve: a platform independent language, to be able to use the same software on several platforms, maybe? but By the way its not - it is cross-platform. It will not work on a platform without a JRE,

More Questions Like This