0

我想了解Java程序是解释还是编译,为什么?

我(想我)知道编译和解释的定义:

编译- 将源代码翻译成机器代码。然后可以执行机器代码。

解释- 翻译代码并同时运行它。翻译一行源代码,运行它,翻译下一行,运行它,等等。

这些定义正确吗?如果是,Java 程序是被解释还是编译,为什么?

4

1 回答 1

2

Java is neither and both.

Java sourcecode is compiled to bytecode, which is then interpreted by the Java Virtual Machine.

于 2014-03-03T20:24:14.823 回答