Java uses Both!?

Java uses Both!?

Java uses both an interpreter and a compiler instead of one or the other. It uses both because originally one of the main uses of the language was to deliver programs to people through the internet. Which means that when people were deciding on what to send to people over the internet(executable code, or source code) they decided to do neither. Instead they sent Bytecode, which served as a intermediate step, so it solved the problem of using a compiler by being platform independent(not needing different versions for different computer systems) and it solves the problem of using a interpreter by protecting the confidentiality of source code and it being faster to interpret than the actual java language. Also, bytecode gave a chance to screen for any security violations, however some security risks remained so this use for java fell out of favor.

So, the program was written by the programmer, compiled on their computer into Bytecode, and then if it was sent over the internet to a different computer it would be sent as that Bytecode, which would then be interpreted and the program would run on whatever computer it was on.

For more information on interpreters and compilers go to the link below, which can also be found on the General page.

https://prog.code.blog/2019/02/13/interpreters-compilers/