Java, C + + are all high-level languages, and the computer can realize that only the machine code (that is, binary), so the high-level language must be directly or indirectly converted into a compilation, to run:
For the advanced computer languages such as C + +, their compilers (such as CC commands under UNIX, CL commands under Windows) can compile the source code directly into machine code that can be recognized by the computer, such as EXE, DLL, and then run directly
And the Java language cross-platform is one of its biggest features, which has reached the Java program Platform headless, so there is a certain sacrifice is more an intermediate process, the Java source program compiled into a class file "bytecode form" storage, It is then loaded by the JVM (the Java Virtual machine, which masks the operating system level, directly providing virtual hardware), and then interprets the bytecode as a machine instruction on the specific platform at execution time.
Each has its pros and cons, so we often say that C + + language is more efficient and Java language platform agnostic
The differences between Java and C + + programs in compiling and running