0

What is the difference between machine code and byte code?

12th Oct 2016, 6:39 PM
Rohit Kumar
Rohit Kumar - avatar
2 Answers
+ 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.
29th Dec 2016, 11:38 PM
Kirk Schafer
Kirk Schafer - avatar
+ 4
Byte code is the machine code of the JVM which generates real machine codes from it.
1st Nov 2016, 10:57 AM
TamĂĄs Barta
TamĂĄs Barta - avatar