0
What is the difference between machine code and byte code?
2 Réponses
+ 5
Tamás Barta said this _much_ more simply; this is just detail.
Bytecode is your human-readable code 'compiled' into a virtual machine's "machine language" (the low-level language the virtual machine ITSELF understands). It's an abstraction for portability.
To have your code run on many OS's, you only need to know how to write for the VM. Because virtual machines are then written to understand Linux, Windows, Android, etc, they all understand each other's bytecode. They handle the final translation to the architecture's machine language (which could be Intel, AMD, ARM, 64- or 32-bit, different libraries, etc). You tell people to install the VM that works for them and your code automatically 'ports'.
In the case of the JVM, your code is also 'safer' (won't crash the OS, violate security, etc) than on the 'bare metal'. At worst you should only be able to destabilize the VM and not the computer.
+ 4
Byte code is the machine code of the JVM which generates real machine codes from it.