Why does Java code need to be compiled but JavaScript code does not

后端 未结 4 1838
夕颜
夕颜 2021-02-07 06:53

How come code written in Java needs to be compiled in byte-code that is interpreted by the JVM, but code written in a language like JavaScript does not need to be compiled and c

4条回答
  •  生来不讨喜
    2021-02-07 07:52

    Because of the being complexity of compiling level between Java and Javascript, there are some limitations in Javascript. Since bytecode is executed on JVM platform which is written for specific OS and Hardware bytecode execution has more advantages to access system resources. Even C code can be embedded into Java bytecode aswell. On the other hand Since Javascript is only run on browser there is less to do with it.

    there are two main part at Java platform. Java programming Language and JVM. It makes each part focus only their own area. That is why JVM doesnot dedal with Java programming syntax. It is similar to that when running C code linking does not deal with C code but assembly.

    Bytecode in JVM platform is likely an assembly in C.

    Eventually all representations are converted into binary representation and then the electirical signals somehow. It proves that we need programming levels.

提交回复
热议问题