Home >Java >javaTutorial >What type of language does java belong to?
The Java language can be said to be an interpreted language, because the compiled Java code is not a language that can be recognized by the machine, but a bytecode, so it cannot be run directly. It requires JVM interpretation to run on various platforms.
Java language
Java language can be said to be compiled, because all Java code must be compiled. .java is of no use without compilation; it can also be said that it is interpreted, because the java code cannot be run directly after compilation. It is interpreted and run on the JVM, so it is interpreted and run.
However, the current JVM has some JIT optimizations for efficiency. It will compile the binary code of .class into local code and run it directly, so it is compiled again.
Like C and C, after one compilation, they can be directly compiled into types that the operating system understands and can be directly executed, so they are compiled languages. Without the second processing, Java is different. It is first compiled by the compiler into a .class type file. This is a file of java's own type. Then it reads one line from the .class file through the virtual machine (JVM), interprets and executes each line. So it is an interpreted language, and because Java has different JVMs for multiple different operating systems, Java is truly cross-platform!
Java's virtual machine mechanism
(1)Java language compilation-->Explanation--->Execution process
(2)Java virtual machine
Compiled language and interpreted language
Compiled language: Compile all completed source programs into executable programs in binary code. You can then run the program directly.
Interpreted language: translate one sentence of the completed source program, and then execute the sentence until the end!
Difference
Compiled language has fast execution speed and high efficiency; it relies on the compiler and is less cross-platform.
Interpreted language has slow execution speed and low efficiency; it relies on the interpreter and has good cross-platform performance.
Summary
Personally, I think Java is an interpreted language, because although Java also needs to be compiled and compiled into a .class file, it is not a language that can be recognized by the machine. , but bytecode, which ultimately requires the interpretation of jvm to be executed on various platforms. This is also the reason why java is cross-platform. So it can be said that Java is both compiled and interpreted, but if it must be classified, from a conceptual definition, I am afraid that Java should be classified as an interpreted language.
The above is the detailed content of What type of language does java belong to?. For more information, please follow other related articles on the PHP Chinese website!