What is Platform Independent? How java is Platform Independent?

Java is a programming language and a platform. Due to its own run time environment (JRE), it is also known as platform.
Platform Independent means “write once and run anywhere”. Here in the programming, writing means compiling. Platform Independent means writing a piece of code on one operating system and that complied code is able to run on another operating system. 
C, C++ are Platform Dependent while java is Platform Independent.

How java is Platform Independent?

Java is Platform Independent because of its Byte Code. When we write or (compile) the java code, it gets converted to Byte Code which can run on all operating systems requires JVM (Java Virtual Machine). JVM is also known as Interpreter which comes along JDK (Java Development Kit) and JRE (Java Run time Environment). JVM converts the ByteCode to the Machine Specific Code.

Why C, C++ is not platform Independent?

Because the these languages compilers directly converts the code to the machine specific code. And this code is different for all the operating systems. 

What is JDK, JRE and JVM? 

Whenever we need to write the java code, we must have JDK installed in our computer. You can download the latest version of JDK from the Oracle official website. When you download the JDK, it download the JDK along with JRE. JVM is subset of JVM. It means every thing get loaded on the download of JDK. A user can also download only JRE.
If some one has to develop the java applications, he must have loaded the JDK in his computer. Means you can say, JDK is for the developers. And if someone has only run the java applications, the JRE is enough.

What is the Portability?

It is simple, means if a code is able to compile on different operating systems. And different operating systems have different compilers.

You can also Read more for more illustrations.

2 thoughts on “What is Platform Independent? How java is Platform Independent?”

  1. There should be specific information like when you write java source code and hit the run button then complier converts it to bytecode and it looks like this i.e 01000111”” and then jvm does this thing to code and now it looks like this and then specifically about different systems how it gets suitable for them.


Leave a Comment