Before starting, why Java is platform independent language, first you know about what is platform independent? The platform Independent means
source code of any programming language can run on any operating system.
Java is platform independent language because when you compile Java source code it
generates corresponding Bytecode that makes it platform independent. And the main important point for java platform independencies is JVM is platform-dependent. Every System has its own JVM which is automatically installed when the JDK software is installed and JVM is capable to read the bytecode or .class file code.
Execution of Java Program: