β˜• Java

Java Interview Questions β€” 100 Q&A All Levels

A complete set of 100 Java interview questions and detailed answers for Fresher, Mid-Level, and Senior developers β€” covering Java basics, OOP, Collections, Exception Handling, Multithreading, Java 8+ features, JVM internals, Design Patterns, Modern Java (17/21), and Spring Boot.

πŸ“…

Last Updated

March 2026

❓

Questions

100 Q&A

🎯

Level

Fresher + Mid + Senior

How to Use This Guide

This guide contains 100 Java interview questions organized by level and topic. Each question includes a detailed, professional answer that covers not just the what, but also the why β€” exactly what interviewers expect from strong candidates.

LevelQuestionsExperienceTopics Covered
🟒 FresherQ1–Q250–1 yearBasics, Data Types, OOP Fundamentals, Strings, Arrays
🟑 Mid-LevelQ26–Q701–3 yearsCollections, Exception Handling, Java 8+, Generics, I/O
πŸ”΄ SeniorQ71–Q1003–6+ yearsMultithreading, JVM, GC, Design Patterns, Modern Java, Spring

Pro tip: Read each answer fully even if you think you know it β€” senior interviewers follow up on surface answers with deeper questions. Understanding the why behind every concept separates average candidates from top performers.

Fresher Level β€” Java Basics & Core Concepts (Q1–Q15)

These are the most commonly asked questions in campus placements and entry-level Java interviews. Every fresher must know all 15 of these cold.

Fresher Level β€” OOP Concepts (Q16–Q25)

OOP is the most heavily tested topic in Java fresher interviews. These 10 questions cover the four pillars, inheritance rules, and interface vs abstract class β€” master every one.

Mid Level β€” Collections Framework (Q26–Q38)

Collections questions are asked in virtually every Java interview at mid-level. Interviewers expect you to know not just the API but the internal implementation and performance characteristics.

Mid Level β€” Exception Handling (Q39–Q48)

Exception handling questions test your understanding of Java's compile-time safety, runtime behavior, and resource management. These come up in virtually every technical round.

Mid Level β€” Java 8+ Features (Q49–Q58)

Java 8 was the most transformative release in Java's history. Lambda expressions, Streams, and Optional are asked in almost every Java interview above fresher level.

Senior Level β€” Multithreading & Concurrency (Q59–Q70)

Concurrency questions separate mid-level from senior candidates. Interviewers expect deep understanding of JMM, thread safety mechanisms, and real-world concurrency patterns.

Senior Level β€” JVM & Memory Management (Q71–Q80)

JVM internals questions demonstrate that you understand what happens below the language level β€” essential for performance tuning, diagnosing production issues, and senior/lead roles.

Senior Level β€” Advanced & Modern Java (Q81–Q100)

These questions cover modern Java (17–21), design patterns, Spring Boot, system design scenarios, and best practices expected from senior/lead developers.

Interview Quick Tips β€” Do's and Don'ts

Knowing the answers is only half the battle. How you communicate your knowledge in the interview room determines whether you get the offer.

  • β–Ά

    βœ… Structure your answers β€” Start with a one-sentence definition, then explain HOW it works, then give a REAL WORLD USE CASE. Interviewers remember concrete examples more than abstract definitions.

  • β–Ά

    βœ… Know the WHY β€” Don't just say what something is β€” explain WHY it was designed that way. 'HashMap allows one null key because null has no hashCode, and it's handled as a special case at bucket 0' β€” this signals deep understanding.

  • β–Ά

    βœ… Mention trade-offs β€” Senior candidates compare options. 'I'd use ArrayList here because random access is frequent, but if we were inserting at the front constantly, I'd reconsider LinkedList or ArrayDeque.'

  • β–Ά

    βœ… Connect to real projects β€” 'In my previous project, we had an N+1 problem with Hibernate that caused 200ms latency per request. We fixed it with JOIN FETCH and reduced it to 15ms.' Real impact numbers impress interviewers.

  • β–Ά

    ❌ Don't memorize without understanding β€” Interviewers follow up on every answer. 'HashMap is O(1)' will be followed by 'Why? How? What's the worst case?' If you memorized without understanding, you'll get stuck.

  • β–Ά

    ❌ Don't bluff β€” If you don't know, say 'I haven't worked with that specific technology, but based on my understanding of X, I'd expect Y.' Honesty + reasoning is far better than confident wrong answers.

  • β–Ά

    ❌ Don't skip basics β€” Senior candidates fail on basics because they assume basics won't be asked. equals()/hashCode() contract, volatile guarantees, and String immutability are asked at ALL levels.

  • β–Ά

    βœ… Mention Java 21 features β€” In 2026, mentioning Virtual Threads, Records, Sealed Classes, and Pattern Matching signals that you keep up with modern Java β€” this differentiates you from candidates stuck on Java 8.

Practice Scenario Questions β€” Think Through These

Senior interviews often include open-ended scenario questions. Practice articulating structured answers to these:

Scenario 1: Your Spring Boot application has intermittent OutOfMemoryError in production. Walk through how you would diagnose and fix it.

Senior

Scenario 2: You have a HashMap in a multi-threaded application and threads are seeing incorrect data. What could be wrong and how do you fix it?

Senior

Scenario 3: A REST endpoint that calls 3 external microservices is taking 3 seconds. How do you optimize it?

Senior

Scenario 4: You need to design a leaderboard for a gaming app that shows top 100 players, updates in real-time, and handles 100,000 concurrent users. Which Java collections/data structures would you use?

Senior

Scenario 5: How would you migrate a Java 8 application to Java 21?

Senior

Scenario 6: A junior developer on your team says 'I use String concatenation in a loop to build a large report string β€” it works fine in testing.' What do you tell them?

Mid

Scenario 7: Explain how you would implement retry logic with exponential backoff for a flaky external API call in Spring Boot.

Senior

Scenario 8: Your team is debating whether to use ArrayList or LinkedList for a queue implementation. What is your recommendation and why?

Mid

Conclusion β€” Your Java Interview Roadmap

You now have 100 comprehensive Java interview questions and answers spanning every level from fresher to senior. But reading alone won't get you the job β€” you need to internalize these concepts, practice articulating them clearly, and connect them to your real project experience.

LevelFocus AreasMinimum Questions to Master
🟒 Fresher (0–1 yr)Basics, String, Arrays, OOP pillars, Collections basicsQ1–Q25 completely, Q26–Q38 basics
🟑 Mid (1–3 yrs)Collections internals, Exception handling, Java 8+, GenericsQ1–Q70 confidently
πŸ”΄ Senior (3–6+ yrs)JVM, GC, Concurrency, Modern Java 17-21, System Design, SpringAll 100, plus system design scenarios
  • β–Ά

    πŸ”₯ Day 1–3 β€” Read and understand Q1–Q25 (Basics + OOP). Write code for every concept. Explain each answer out loud to yourself or a friend.

  • β–Ά

    πŸ”₯ Day 4–7 β€” Study Q26–Q58 (Collections + Exception Handling + Java 8). Build small programs using Streams, Optional, and Collections.

  • β–Ά

    πŸ”₯ Day 8–12 β€” Study Q59–Q100 (Concurrency + JVM + Advanced). Use VisualVM, jstack, and profilers at least once.

  • β–Ά

    πŸ”₯ Day 13–14 β€” Practice scenario questions. Mock interview with a colleague. Review your weak areas. Code the data structures from scratch.

  • β–Ά

    πŸ’‘ Key mindset β€” Interviewers are not looking for people who memorized a book. They want developers who UNDERSTAND deeply, can THINK through problems, and communicate clearly. Be that developer.

Java is not dying β€” Java is evolving. With Virtual Threads, Records, Pattern Matching, and continued enterprise adoption, Java in 2026 is more relevant and more powerful than ever. Master it, and you open doors to some of the best-paying engineering roles in the world. β˜•

Frequently Asked Questions (FAQ)