Skip to content

Java developer interview questions and answers (India)

LiveRec EditorialUpdated

Java developer interview questions in India usually run in rounds: an online test or screening, one or two technical rounds on core Java, data structures and frameworks, then HR. Prepare the fundamentals first, because most rejections come from weak basics. Know your own projects well enough to explain every decision.

At a glance

  • Core Java and OOP concepts decide most screening rounds.
  • Freshers: data structures, basic coding and one project. Experienced: frameworks, design, debugging.
  • Be ready to write code on a screen or in a shared editor.
  • HR rounds ask about notice period, CTC and location.
  • Prepare to explain your projects line by line.

Core Java questions

TopicTypical question
OOPExplain encapsulation, inheritance, polymorphism and abstraction with examples
ClassesDifference between an abstract class and an interface
MemoryHow does garbage collection work? What are stack and heap?
StringsWhy is String immutable? String versus StringBuilder
Equality== versus equals(); why override hashCode()
ExceptionsChecked versus unchecked; try-with-resources
Keywordsfinal, static, volatile

Collections and concurrency

  • How does a HashMap work internally? What happens on a collision?
  • ArrayList versus LinkedList; HashMap versus ConcurrentHashMap.
  • Threads: creating them, synchronisation, synchronized versus locks.
  • What is a deadlock and how do you avoid it?

Modern Java

Be ready for lambdas, streams, Optional, records and the features of the Java version your target company uses. Ask the recruiter which version the team runs.

Frameworks and tools (experienced)

  • Spring and Spring Boot: dependency injection, beans, configuration, REST controllers.
  • JPA and Hibernate: entities, lazy versus eager loading, the N+1 query problem.
  • Testing: unit tests and mocks.
  • Build and version tools: Maven or Gradle, Git.

SQL and design basics

Joins, indexes and transactions; basic REST design; how you would handle caching, pagination and error handling at a high level. For general engineering preparation, see software engineer interview questions.

How to explain your project

  1. What problem it solved and for whom.
  2. Your role and the stack.
  3. One technical challenge and how you solved it.
  4. What you would do differently.

HR round points

Prepare answers on notice period, current and expected CTC, willingness to relocate and why you are changing jobs. See HR questions for freshers and notice period in India.

Model answers to the most-asked questions

These short answers follow Oracle's official Java tutorials (accessed 31 October 2026). Put them in your own words and add an example from your project.

Abstract class versus interface. Oracle defines an abstract class as a class declared abstract that may or may not include abstract methods; it cannot be instantiated, but it can be subclassed. The tutorial says that with abstract classes you can declare fields that are not static and final, while with interfaces all fields are automatically public, static and final. You can extend only one class, but you can implement any number of interfaces. Use an abstract class to share code among closely related classes, and an interface to specify behavior that unrelated classes can implement.

Checked and unchecked exceptions. Oracle describes three kinds. Checked exceptions are conditions a well-written application should anticipate and recover from, and they are subject to the catch or specify requirement. Errors are conditions external to the application that it usually cannot recover from. Runtime exceptions are internal conditions that usually indicate programming bugs, such as passing null where it is not allowed. Errors and runtime exceptions together are called unchecked exceptions.

Object and class. Oracle's tutorial defines an object as a software bundle of related state and behavior, and a class as a blueprint from which objects are created. A short example, such as Order as the class and one customer's order as the object, makes this answer concrete.

How to answer a coding question, step by step

  1. Repeat the problem and ask about input size and edge cases.
  2. State a simple approach first, even if it is slow.
  3. Say its time and space cost, then improve it.
  4. Write clean code with clear names, then walk through a small example by hand.
  5. Test null, empty and duplicate inputs out loud.

Quick practice list by experience

LevelPractise this week
FresherStrings, arrays, HashMap use, OOP examples, one project walkthrough
2 to 4 yearsCollections internals, multithreading basics, Spring Boot REST flow, SQL joins
5 years and moreDesign of a small service, debugging a slow endpoint, code review habits

Common mistakes

  • Memorising definitions without being able to write the code.
  • Listing technologies on a resume that you cannot explain.
  • Not asking clarifying questions in a coding round.
  • Giving an HR answer on CTC or notice period that you have not thought through.
  • Blaming a past team when asked about a failed project.

Frequently asked questions

Which Java topics matter most for freshers? OOP, strings, collections, exceptions and basic data structures.

Do the questions change with experience? Yes. Freshers get fundamentals, experienced candidates get design and troubleshooting.

Should I learn Spring Boot as a fresher? It helps if the job post names it. Fundamentals come first.

Is knowing Java 8 features enough? Ask which Java version the team runs. Many teams expect lambdas and streams at minimum.

Will I be asked to write code on paper? Possibly. Practise writing without an IDE so syntax comes naturally.

What if I do not know an answer? Say what you do know, reason aloud, and ask a clarifying question instead of guessing.

Next step

Write code for five core questions without an IDE, then practice explaining your main project in three minutes.

This page is general career information.