Cosmic Module
J
Qubits of DPK
March 24, 2026
Core Java
Layman Explanation
Before you can cook, you need a kitchen with tools. JDK is your kitchen — it has everything needed to write, compile and run Java programs.
What JDK Contains
javascript
QUBITS OF DPK
Setup Steps
- #Download JDK from https://adoptium.net (OpenJDK — free)
- #Install and set JAVA_HOME environment variable
- #Add %JAVA_HOME%/bin to PATH
- #Verify: java -version and javac -version in terminal
️ Common Mistakes
- Confusing JDK with JRE — JRE only runs, JDK develops
- Not setting PATH correctly → javac not found error
- Installing 32-bit JDK on 64-bit OS → performance issues
Interview Answer
"JDK is the Java Development Kit — it includes the compiler (javac), launcher (java), and JRE. For just running Java programs, JRE suffices. For development, JDK is mandatory."
Interview Questions & MAANG-Level Answers
Q1. What is the difference between JDK, JRE and JVM?
JVM (Java Virtual Machine) is the engine that executes bytecode — it contains Class Loader, Execution Engine (Interpreter + JIT), Memory areas, and Garbage Collector. JRE (Java Runtime Environment) = JVM + Java class libraries (java.lang, java.util, java.io etc.) — everything needed to RUN Java programs. JDK (Java Development Kit) = JRE + development tools (javac compiler, jdb debugger, jar tool, javadoc generator) — everything needed to DEVELOP Java programs. They are nested: JVM ⊂ JRE ⊂ JDK.
Q2. What tools come with the JDK?
Key JDK tools: javac — compiler, converts .java to .class bytecode. java — launcher, starts JVM and runs .class files. jar — creates and manages .jar archive files. javadoc — generates HTML documentation from code comments. jdb — Java debugger. jconsole / jvisualvm — JVM monitoring and profiling. jstack — prints thread dumps (critical for debugging deadlocks in production). jmap — heap dump analysis. javap — disassembles .class files to view bytecode.
Q3. What is JAVA_HOME and why is it important?
JAVA_HOME is an environment variable pointing to the JDK installation directory. Many tools (Maven, Gradle, Tomcat, IDEs) rely on JAVA_HOME to find the JDK. Without it, builds fail with "JAVA_HOME not set" errors. %JAVA_HOME%/bin added to PATH enables running java, javac from any terminal directory. In production: multiple Java versions can coexist — JAVA_HOME determines which is active. Tools like jenv (Mac/Linux) or SDKMAN manage multiple JDK versions cleanly.
Q4. What is OpenJDK vs Oracle JDK?
Oracle JDK: Official Oracle distribution, free for development but requires commercial license for production use (since Java 11). OpenJDK: Open-source reference implementation, completely free including production use, community maintained. Feature-wise they are nearly identical (Oracle JDK had some extras historically but gap has closed). In practice: most companies use OpenJDK distributions (Amazon Corretto, Microsoft OpenJDK, Eclipse Temurin/Adoptium) in production. For interviews: both compile and run the same Java code identically.
Q5. What is the LTS (Long-Term Support) release model?
Java releases a new version every 6 months but only some are LTS (Long-Term Support) with multi-year security patches. LTS versions: Java 8 (2014, still widely used), Java 11 (2018), Java 17 (2021), Java 21 (2023). Non-LTS versions get support for only 6 months. Production systems almost always use LTS versions for stability. Java 21 is the current LTS as of 2024. Interview context: knowing which Java version a company uses matters — many enterprises still run Java 11 or 17.