The Java language is extraordinary.
1. You can say it is compiled. Because all Java code is compiled,. Java is useless without compilation.
2. You can say it is interpreted. Because Java code cannot be directly run after compilation, it is interpreted to run on JVM, so it is interpreted to run, and that is even explained.
Iii. However, the current JVM has some JIT optimizations for efficiency. It also compiles the binary code of. class into local code and runs it directly.
C and C ++, after a compilation, can be directly compiled into a type known to the operating system and can be directly executed. Therefore, they are compiled languages. Without the second processing, Java is not the same. It is first compiled by the compiler. class-type files, which are Java-type files and then from. the class file reads a line of explanation and executes a line, so it is an interpreted language, and Java has different JVM for different operating systems.
Java implements a true cross-platform!
See the following two figures to learn about the Java Virtual Machine mechanism:
(1) Java language compilation --> explanation ---> Execution Process
(2) Java Virtual Machine
Today, I heard my colleagues discuss which type of language Java is (compiler type and Interpretation Type). I was a little touched, but the concept is vague. In order not to let others think about myself, so I found some information and found some answers from enthusiastic netizens. The definitions of compiled and interpreted languages are given first.
Definition:
Compile-type language: compile all the source programs into executable programs with binary code. Then, you can run the program directly.
Explanatory language: translate a prepared source program and execute it until the end!
Differences:
Compile-type language, fast execution speed, high efficiency, depending on the compiler, less cross-platform performance.
Interpreted language, slow execution speed and low efficiency; good interpreter and cross-platform performance.
I personally think that Java is an interpreted language, because although Java also needs to be compiled. class file, but not a language that can be recognized by machines, but a bytecode. In the end, it still needs to be interpreted by JVM to be executed on various platforms. This is also the reason for Java cross-platform execution. Therefore, Java is both compiled and interpreted, but I am afraid Java should be classified into interpreted languages in terms of concept definition.
Appendix:
Compiled languages include C, C ++, Delphi, Pascal, and FORTRAN.
Interpreted languages include Java, basic, and javas.Bytes