Why java is platform independent?

Java is platform-independent because it does not depend on any type of platform and it uses a virtual machine. That is why, Java is platform-independent language.

In Java programming language, programs are compiled into byte code and that byte code is platform-independent.

The virtual machine takes care of the differences between the bytecodes for the different platforms.

JVM (Java Virtual Machine) is platform dependent because it takes java byte code and generates byte code for the current operating system.

Therefore, Java software is platform dependent but Java language is platform independent because different operating system have different JVMs.

👈       👉