D
DevPrepSystematic Prep
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

Open Full Easy List
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, debugger jdb, 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, default 0.
  • short: 2 bytes, default 0.
  • int: 4 bytes, default 0.
  • long: 8 bytes, default 0L.
  • float: 4 bytes, default 0.0f.
  • double: 8 bytes, default 0.0d.
  • char: 2 bytes (Unicode), default '\u0000'.
  • boolean: JVM-dependent (effectively 1 bit/byte), default false.
Q5Explain the concept of Autoboxing and Unboxing.
  • Autoboxing: Automatic conversion of primitive types to their corresponding wrapper classes by the Java compiler (e.g., int to Integer).
  • Unboxing: The reverse process—automatic conversion of wrapper class instances back into primitive types (e.g., Double to double).
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
DEDICATED LEVEL PAGES

Browse All Java Questions by Difficulty

INTERNAL LINKING & DEPENDENCIES

Related Technologies to Java

CAREER PATHWAYS

Java is a key requirement for these engineering roles:

Java Interview Questions — Easy, Medium & Hard | DevPrep | DevPrep