Bytecode vs Machine Code
People think bytecode is machine code, and it is not. Machine code is the steps a chip runs directly, so it only works on one chip family. Bytecode is a list of simpler steps for a virtual machine, which a program reads and runs. That makes it work on any chip that has the virtual machine. Python, Java and C# all make bytecode first.
Bytecode
A halfway form of code. A virtual machine runs it on any computer.
Bytecode is a halfway form of code, made to sit between source code and machine code. A compiler turns source code into bytecode, and then a virtual machine runs it. The same bytecode runs on any computer that has that machine. Java turns code into bytecode for the JVM. Python makes it too, out of sight, each time it runs a file.
Machine Code
The raw steps a chip runs on its own. Compilers make it for you.
Machine code is the set of simple steps a computer's chip runs directly. Each step is a number, like add two values or jump to another step. Every chip family has its own, so code made for one may not run on another. People almost never write it by hand. A compiler makes it from code written in a language people can read.
In one line
- Bytecode
- A halfway form of code. A virtual machine runs it on any computer.
- Machine Code
- The raw steps a chip runs on its own. Compilers make it for you.