What type of language is Java?

⭐Column introduction

This column will continue to update various questions about JAVA, including interview questions, JAVA introduction to proficiency, etc.

The update speed is maintained at 3-5 articles per day

Insert image description here

What type of language is Java?

Insert image description here

1. You can say that it is compiled: because all Java code must be compiled, .java is useless without compilation.
Second, you can say that it is interpreted: because the Java code cannot be run directly after compilation, it is interpreted and run on the JVM, so if it is interpreted and run, it is considered interpreted.
3. 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.

Definition:
(1) Compiled language: a executable program that compiles all completed source programs into binary code. You can then run the program directly.
(2) Interpreted language: Translate one sentence of the completed source program, and then execute the sentence until the end!
Differences:
(1) Compiled languages ​​have fast execution speed and high efficiency; they rely on compilers and are less cross-platform.
(2) Interpreted language has slow execution speed and low efficiency; it relies on the interpreter and has good cross-platform performance.

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. In the end, it still needs interpretation by the jvm to execute on various platforms. At the same time, 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.
Attachment:
Compiled languages ​​include: C, C++, Delphi, Pascal, Fortran
Interpreted languages ​​include: Java, Basic, javascript, python

Guess you like

Origin blog.csdn.net/weixin_50843918/article/details/132890484