What is the JVM (Java Virtual Machine)?
Options
- A program that runs bytecode between your code and the OS (Correct option)
- An editor that writes and checks the Java source code
- A cloud server that hosts Java applications for you
- A database that stores Java objects between the runs
Answer
A program that runs Java bytecode and sits between your program and the operating system, so the same .class files run on Windows, Linux or macOS
Why
Bytecode is not tied to a specific processor or operating system. Each operating system has its own JVM that knows how to run it.
This is the idea behind 'write once, run anywhere'.
The JVM also manages memory for you: it creates objects and the garbage collector removes the ones no longer used.
Remember
JVM = the engine that runs Java bytecode on any OS.