1 Answer

answered by
The java compiles the code exactly as a set of instructions for the virtual CPU which works the same on every type of machine. Java achieves this platform independence through the implementation of JVM (Java Virtual Machine).
The role of the JVM is to read the Java application through the ClassLoader and execute it along with the Java API.
The running JVM executes the Java bytecode provided that the JVM is available for virtual CPU to execute upon.

The compiled bytecodes together with JVM makes java a platform independent as well as follow the principles of Write Once Run Anywhere.

Read more about it here: https://www.cubrid.org/blog/understanding-jvm-internals/
0 votes
...