Reprint please specify the original address: http://www.cnblogs.com/ygj0930/p/5827273.html C + +: Compile (different systems compile different machine code, so the same C/C + + file can not be executed in some systems, because the compilation of Different machine code) code ———— machine code ———— in the operating system by the hard disk read into memory run--memory--cpu--output Java: Compiled bytecode run on the virtual machine, virtual machine equivalent to translation officer, different system JVM, different conversion rules , convert the same bytecode file to the corresponding system's machine code code ———— bytecode file (. Class) ———— JVM ———— machine code to run on the appropriate system-memory--cpu--results due to the existence of the JVM, it is only necessary to install the appropriate JVM on different systems. The same. class file runs on the JVM of the corresponding system and outputs the machine code that the corresponding system can parse to run successfully. This is, once compiled, run everywhere. For example, is: A book written in Chinese characters (source code), to different countries (systems), each country has a corresponding translation officer (JVM virtual machine) to translate the Chinese characters into the language of their country (such as the book to the English translation into the book), and then can be circulated in this country (equivalent to the successful operation of the program). Also, add: Java has two features: portability: Compile once, run everywhere (explained above) security: Automatically reclaims infrequently used command garbage in memory to prevent memory overflow.
Simple comparison of "Java" C + + and Java