A program written in the Java programming language can run on any platform because...
Java programming is derived from C++.
The Java Virtual Machine1(JVM) interprets the program for the native operating system.
The compiler is identical to a C++ compiler.
The APIs do all the work.