Core Java

What the JVM is really doing under your code. Memory, the String pool, wrappers, exceptions, GC, generics and modern Java — the round that decides whether the rest of the interview happens.

Topics in this section

JDK vs JRE vs JVM

The JDK is the whole kitchen, tools included. The JRE is just the stove and the pantry: enough to cook, nothing to build with. The JVM is the chef who reads the recipe (bytecode) and cooks it on whatever stove it's standing at.

Stack, heap and Metaspace

The stack is your desk: every method call gets a sticky note (a frame) that goes in the bin the moment the call returns. The heap is the warehouse where every object lives until nobody holds its ticket any more.

String pool & immutability

The String pool is a shared rack of name badges. Write "java" twice and both variables wear the same badge. `new String("java")` prints a brand-new badge that just happens to say the same thing.

Wrappers, autoboxing & the Integer cache

A primitive is a coin in your pocket. A wrapper is that coin in a labelled box, so it can go into a collection. Java boxes and unboxes for you — and keeps ready-made boxes for every number from -128 to 127.

Checked vs unchecked exceptions

Checked exceptions are the weather forecast: foreseeable, so the compiler makes you carry an umbrella (catch it or declare it). Unchecked exceptions are tripping over your own shoelace: a bug to fix, not something to plan around.

static, final, finally, finalize

`static` is one whiteboard shared by the whole class. `final` means written in pen: can't reassign it, can't override it, can't extend it. `finally` is the clean-up crew. `finalize` is a retired employee — don't call him.

Each topic pairs a plain-language explanation with code, interview questions, and related practice where available.