What is Platform Independence and Why Java is Portable?

Java is a general programming language. It is designed to have the minimum number of implementation dependencies in a program.

Platform Independent:

Platform independent means that the program that we executed on one system can be operated on the other system as well. It does not need any further modification to execute on another system.
In simple words, Java source code can run on all operating systems without any further modification. 


It is an object code processed by the written program. In other words, it is a portable code in the form of instructions to execute the program. 


Portable is one of the features of Java. It is called portable because the Java compiler gives output in Bytecode. And after that, it can be operated on different operating systems. We do not need any type of modification to run the Java code. The only thing to have is JVM.

Java language is portable. It means that we can execute Java Bytecode on any operating system. If we stay away from specific-platform extensions, then the code will not be executed. And it will not stay portable as well. If we want to run that code by staying away from specific platform extensions, we must have to re-build the code and then we can execute the code.  
The following are some of the reasons why Java language is portable
  • The Java compiler gives output in Bytecode.
  • Bytecode is a set of instructions to run the code.
  • Bytecode can only be executed by Java Virtual Machine (JVM)
  • In JVM, it only accepts instruction (Bytecode) and then it executes the code.
  • JVM has different internal details but all of the Java Virtual Machines can read and execute the Bytecode.
  • Bytecode can only be executed using JVM. 

No comments