What's the difference between compiled and interpreted language?

前端 未结 7 1393
Happy的楠姐
Happy的楠姐 2020-12-02 03:46

After reading some material on this subject I\'m still not sure what the difference between a compiled language and an interpreted language is. I was told this is one of the

7条回答
  •  一整个雨季
    2020-12-02 03:55

    It is a very murky distinction, and in fact generally not a property of a language itself, but rather of the program you are using to execute code in that language.

    However, most languages are used primarily in one form or the other, and yes, Java is essentially always compiled, while javascript is essentially always interpreted.

    To compile source code is to run a program on it that generates a binary, executable file that, when run, has the behavior defined by the source. For instance, javac compiles human-readbale .java files into machine-readable .class files.

    To interpret source code is run a program on it that produces the defined behavior right away, without generating an intermediary file. For instance, when your web browser loads stackoverflow.com, it interprets a bunch of javascript (which you can look at by viewing the page source) and produces lots of the nice effects these pages have - for instance, upvoting, or the little notifier bars across the top.

提交回复
热议问题