DEVPREP CODEX · #10
Java Interview Questions
171 curated questions graded from Foundations (Easy) to Practical Patterns (Medium) and Internals & Architecture (Hard).
TOTAL QUESTIONS
171
THEORY QUESTIONS
150
IMPLEMENTATION FOLIOS
21
FREE QUESTIONS
5 / Level
Easy Level·57 Questions Total
Foundations & Core Concepts
Q1What is Java? Why is it considered platform-independent?
- Java: A high-level, class-based, object-oriented programming language.
- Platform Independence: Java uses a "Write Once, Run Anywhere" (WORA) model. The Java compiler (
javac) converts source code (.java) into intermediate bytecode (.class). The Java Virtual Machine (JVM) interprets or compiles this bytecode into native machine code specific to the host operating system.
Q2Explain the differences between JDK, JRE, and JVM.
- JVM (Java Virtual Machine): The execution engine that runs Java bytecode on the host OS.
- JRE (Java Runtime Environment): JVM + Libraries + core files required to run compiled Java applications.
- JDK (Java Development Kit): JRE + Development Tools (compiler
javac, debuggerjdb, packager).
Q3What is the JIT Compiler and how does it work?
- JIT (Just-In-Time) Compiler: A component of the JVM's execution engine.
- Mechanism: Instead of interpreting bytecode line-by-line repeatedly, JIT compiles frequently executed code blocks ("hotspots") directly into native machine code at runtime, caching it for subsequent executions to boost performance.
Q4List the primitive data types in Java, their sizes, and default values.
byte: 1 byte, default0.short: 2 bytes, default0.int: 4 bytes, default0.long: 8 bytes, default0L.float: 4 bytes, default0.0f.double: 8 bytes, default0.0d.char: 2 bytes (Unicode), default'\u0000'.boolean: JVM-dependent (effectively 1 bit/byte), defaultfalse.
Q5Explain the concept of Autoboxing and Unboxing.
- Autoboxing: Automatic conversion of primitive types to their corresponding wrapper classes by the Java compiler (e.g.,
inttoInteger). - Unboxing: The reverse process—automatic conversion of wrapper class instances back into primitive types (e.g.,
Doubletodouble).
52 More Easy Questions Locked
Unlock the complete Java Easy question bank
Get instant access to all 57 questions, in-depth model answers, code sandboxes, and all 27+ technologies for a single one-time payment.
Unlock All — One-time payment · Lifetime access
Browse All Java Questions by Difficulty
Easy57 Questions
Core concepts, definitions, basic syntax, and first principles expected in round 1 screening.
VIEW FULL LIST
Medium57 Questions
Real-world mechanisms, state management, edge cases, performance trade-offs, and practical coding.
VIEW FULL LIST
Hard57 Questions
Deep runtime internals, memory models, distributed design, concurrency failure modes, and architectural decisions.
VIEW FULL LIST
INTERNAL LINKING & DEPENDENCIES