So as we learnt in the previous tutorial machine language is the only language a computer understands and machine codes when written can be run directly by the computer because that it language. thoughhhh
For a computer to understand a high-level language, it has to be translated to it own language which is machine language. There are a couple of ways this could be done. It could be compiled by something called a compiler.
What a compiler does is convert the entire code into an executable machine code and feeds it into the computer. But there’s a catch here, every computer has it own different type of machine language which means the compiled code for one machine won’t run on another, it has to be recompiled by it own compiler.
Another way of executing your program is by interpreting it with something called an interpreter. Unlike the compiler which takes the entire code and converts them all at once before feeding it to the computer, the interpreter on the other hand does it differently.
The interpreter translates your code by running it instruction-by-instruction and not all at once. It is sometimes considered better by some people because if it encounters an error it simply stops working which means you know where the error is on.
But if it were to be a compiler, after it compiles the entire code and then encounters an error it usually very difficult and stressful to spot the problem.
The bytecode is much like a machine language that can run ln any computer all that is needed by the computer is just an interpreter for java bytecode.
This amazing feature is what makes java a “WORE” write once run everywhere language. So if you write a java code you don’t have to bother yourself about re-writing a java code to be compatible by a computer.
Don’t forget to share this if you liked it and also if you’ve got any questions or suggestions don’t hesitate to let us know down in the comment section. Also don’t forget to read read the next one on your programming journey.➡