Java Interview: A Checklist That Will Save Your Career

Online Python Trainer for Beginners

Learn Python easily without overwhelming theory. Solve practical tasks with automatic checking, get hints in Russian, and write code directly in your browser — no installation required.

Start Course

Introduction: Why Java Doesn't Forgive Sloppiness

\n\n

You sent your resume, passed the HR screening, and here it is — an invitation to a technical interview. If you are reading this article on pythonlib.ru, it means you are either switching from Python to Java, or simply gathering a "knowledge base." In any case — you are on the right track.

\n\n

Java is not a language where you can "slide through" on charisma. The enterprise ecosystem requires a clear understanding: from JMM (Java Memory Model) to how the Garbage Collector works. A Java interview is not an exam, it's a dialogue. But a dialogue where your strength will be tested.

\n\n

In this article, I have compiled a real checklist: what to study, how to answer, and — most importantly — how not to embarrass yourself during live coding. No fluff, just practice.

\n\n

1. Java Core: The Foundation You Need to Know by Heart

\n\n

Let's start with the basics. Without Java Core, no one will even listen to you. Here is a list of topics every candidate must know:

\n\n

1.1. OOP (Object-Oriented Programming)

\n

You must be able to explain polymorphism, inheritance, encapsulation, and abstraction simply, with examples.

\n\n

Trick question: "What is the difference between an abstract class and an interface?"

\n

Correct answer: In Java 8+, interfaces can have default methods, but an abstract class can contain state (fields), while an interface cannot.

\n\n
// Example: abstract class\nabstract class Animal {\n    protected String name;\n    abstract void makeSound();\n}\n\n// Interface with default method\ninterface Movable {\n    default void move() {\n        System.out.println("Moving...");\n    }\n}
\n\n

1.2. Collections (Java Collections Framework)

\n

This is a must-have. Knowing HashMap, ArrayList, HashSet, TreeMap is not enough. You need to understand:

\n
    \n
  • How HashMap works (array + linked list + red-black tree since Java 8)
  • \n
  • The difference between fail-fast and fail-safe iterators
  • \n
  • When to use LinkedList instead of ArrayList (spoiler: almost never)
  • \n
\n\n

Tip: During an interview, you might be asked to write your own implementation of HashMap. Practice beforehand.

\n\n

1.3. Exceptions

\n

Checked vs Unchecked — a classic. Remember: RuntimeException and its subclasses are unchecked, everything else is checked. And never, I mean never, use catch (Exception e) {} — it's an anti-pattern.

\n\n

2. Multithreading: The Topic Where 80% of Candidates Fail

\n\n

Java is one of the few languages where multithreading is built into the language level. During an interview, you will definitely be asked about synchronized, volatile, AtomicInteger, Lock, Semaphore.

\n\n

2.1. The volatile Keyword

\n

The main question: "Does volatile guarantee atomicity?" Answer: No. It only guarantees visibility of changes between threads.

\n\n
public class VolatileExample {\n    private volatile boolean flag = true;\n\n    public void stop() {\n        flag = false; // Another thread will see this change immediately\n    }\n}
\n\n

2.2. Deadlock and How to Avoid It

\n

You may be asked to write code that leads to a deadlock, and then fix it.

\n\n
// Classic deadlock\npublic class DeadlockExample {\n    private final Object lock1 = new Object();\n    private final Object lock2 = new Object();\n\n    public void method1() {\n        synchronized (lock1) {\n            synchronized (lock2) { /* ... */ }\n        }\n    }\n\n    public void method2() {\n        synchronized (lock2) {\n            synchronized (lock1) { /* ... */ }\n        }\n    }\n}
\n\n

Solution: always acquire locks in the same order, or use tryLock() from the java.util.concurrent.locks package.

\n\n

3. Spring Framework

Blogs

Book Recommendations