Reply:
A Java Virtual machine is a virtual machine process that can execute Java bytecode. Java source files are compiled by the Javac compiler to generate bytecode files that can be executed by a Java virtual machine.
Java is designed to allow applications to run on any platform without requiring programmers to rewrite or recompile each platform individually. The so-called cross-platform is installed on different platforms different JVM, and on different platforms. class files are the same, and. class files are then interpreted by the corresponding platform JVM as the corresponding platform's machine code execution.
Analytical:
Java cross-platform is not a cross-platform of Java source programs, if so, so the language is cross-platform, The Java source program is compiled by the Javac compiler into binary. Class bytecode files (Java cross-platform refers to the. class bytecode file cross-platform,. Class bytecode files are platform-independent), the. class file runs on the JVM, and the Java Interpreter (part of the JVM) interpreted as the machine code execution of the corresponding platform, so what Java so-called cross-platform is to install different JVMs on different platforms, and the. class files generated on different platforms are the same, and the. class file is then interpreted by the corresponding platform JVM as the corresponding platform's machine code execution.
Finally, the difference between the machine code and the bytecode is explained:
One, machine code, fully attached to the hardware and exist, and different hardware due to the embedded instruction set is different, even if the same 0 1 code meaning may be different ~ in other words, there is no cross-platform-for example, different models of CPU, you give him a command 10001101, they may be resolved to different results.
Two, we know that Java is cross-platform, why? Because he has a JVM, no matter what kind of hardware, as long as you have the JVM, then he knew this Java bytecode. As for the bottom of the machine code, we do not have to tube, a JVM to do, he will translate the bytecode into the machine that the machine knows the code.
What is a Java virtual machine? Why is Java called a "platform-agnostic programming language"?