Interview question
What is the difference between JVM, JDK, and JRE? JVM, JDK और JRE में क्या अंतर है?
Answer
| Component | JVM (Java Virtual Machine) | JRE (Java Runtime Environment) | JDK (Java Development Kit) |
|---|---|---|---|
| Purpose | Executes Java bytecode | Runtime environment for Java apps | Complete development environment |
| Contains | Only bytecode execution | JVM + libraries + tools for running | JRE + compiler + debugger + tools |
| Use Case | Execute compiled bytecode | Run Java applications | Develop Java applications |
| Compilation | N/A | Not needed | Includes javac compiler |
| Size | Smallest | Medium | Largest |
| Users | End users | End users (users running apps) | Developers |
// Compilation Process
// 1. Developer writes .java files
// 2. javac (in JDK) compiles to .class bytecode
// 3. JVM (in JRE) executes the .class files
// Example:
// javac HelloWorld.java // JDK compiler
// java HelloWorld // JVM execution
// Relationship:
// JDK = JRE + Development Tools
// JRE = JVM + Libraries
// JVM = Bytecode Execution Engine
// Installation:
// To run Java apps: Install JRE only
// To develop Java apps: Install JDK (which includes JRE)| Component | Description |
|---|---|
| JVM | Java bytecode को execute करता है |
| JRE | JVM + libraries - apps run करने के लिए |
| JDK | JRE + compiler + tools - development के लिए |
Was this answer clear?