Java language seems to be compiled, because Java program code does need to be compiled.
Do you remember using the javac command in cmd? That’s right, javac is used to compile Java program code (compile .java source programs into .class files). Without compilation, .java files cannot run!
The Java language seems to be interpreted. , because Java programs need to be interpreted and run on the JVM.
(Free learning video tutorial sharing: java video tutorial)
So what type of language is Java?
Java is an interpreted language
Why is Java an interpreted language?
Java is first compiled into a .class type file by the compiler. 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 one line, so it is an interpretation It is precisely because Java is interpreted and run on the JVM that there are different JVMs for different operating systems, so Java can achieve true cross-platform!
A few more pictures to help understand Java’s interpretation and execution process:
Through the above introduction, we will have a clear understanding of the Java program execution process.
So, Java is an interpreted language with good cross-platform performance.
Recommended related articles and tutorials: java introductory tutorial
The above is the detailed content of Is java a compiled language or an interpreted language?. For more information, please follow other related articles on the PHP Chinese website!