Back to Tech Interviews

Java & Spring Boot Interview

Curated 20+ questions covering Java OOP, JVM garbage collection, Spring IoC/DI, Spring Boot configurations, and JPA/Hibernate.

Total: 20 QuestionsLearned: 0 / 20 (0%)
Difficulty Filters

Tools & Options
Showing 20 of 20 questions
Beginner
What are the core principles of Object-Oriented Programming (OOP)?

The four core principles of OOP are:

1. Encapsulation: Hiding data fields and exposing them through getter/setter methods.

2. Inheritance: Creating parent-child relationships between classes to reuse code.

3. Polymorphism: Allowing methods to take different forms (Method Overloading and Method Overriding).

4. Abstraction: Hiding internal implementation details using interfaces and abstract classes.

Beginner
What is Spring Boot, and how does it differ from the Spring Framework?

Spring is a Java application framework providing dependency injection and core components. Spring Boot is an extension of Spring that makes it easy to create stand-alone, production-ready applications. It simplifies development by providing:

1. Auto-configuration: Automatically configures beans based on classpath dependencies.

2. Starters: Pre-packaged dependency bundles.

3. Embedded Server: Built-in Tomcat/Jetty, avoiding standalone WAR deployments.

Intermediate
Explain Dependency Injection (DI) and Inversion of Control (IoC).

Inversion of Control (IoC) is a design principle where the control of object creation and lifecycle is transferred from the program code to a container. Dependency Injection (DI) is a specific implementation of IoC where dependencies are dynamically injected into a class (via Constructor, Setter, or Field) by the Spring IoC container.

@Component
public class Car {
    private Engine engine;

    // Constructor injection (Preferred)
    @Autowired
    public Car(Engine engine) {
        this.engine = engine;
    }
}
Beginner
What are the different ways to inject dependencies in Spring?
Intermediate
What is Spring Boot Auto-configuration, and how does it work?
Beginner
What is Spring Boot Actuator?
Beginner
What is the difference between `@Component`, `@Service`, and `@Repository` annotations?
Intermediate
Explain Spring Bean Scopes.
Intermediate
What is Hibernate, and how does it relate to JPA?
Beginner
What is the difference between `@RestController` and `@Controller`?
Beginner
What is the Spring Boot Starter?
Intermediate
How do you handle exceptions globally in Spring Boot?
Intermediate
Explain Lazy Loading vs Eager Loading in Hibernate/JPA.
Advanced
What is the N+1 select problem in Hibernate, and how do you resolve it?
Advanced
Explain the garbage collection process in Java.
Intermediate
What is the difference between `HashMap` and `ConcurrentHashMap` in Java?
Advanced
Explain Spring AOP (Aspect-Oriented Programming).
Intermediate
What is the use of the `@Transactional` annotation?
Advanced
What is the Spring Cloud, and when is it used?
Beginner
Explain the Java 8 Stream API.

Technical Interview Mastery Blueprint

Proven methodologies and frameworks to succeed in technical and architecture rounds.

1. The Engineering STAR Technique

When responding to architectural or situational questions, structure your answer using Situation, Technical Constraint, Action, and Measurable Result. Rather than jumping straight to syntax, articulate the business problem, why certain patterns (e.g. caching, queuing, immutability) were selected over alternatives, and what latency or throughput improvements were achieved.

2. Defending Architectural Trade-Offs

Senior interviewers evaluate how you weigh trade-offs. Always explain why you chose an approach: e.g., memory overhead vs CPU cycle speed, consistency vs availability (CAP theorem), or normalized schemas vs denormalized fast reads. Stating the drawbacks of your own proposal demonstrates maturity and production experience.

3. Clean Code & Edge-Case Proactivity

In live-coding rounds, communicate your thinking aloud before typing. State edge cases explicitly: null or undefined inputs, extreme boundary values, concurrency races, and network timeouts. Writing modular, well-named functions with deterministic unit tests separates junior candidates from staff-level engineers.

4. Antipatterns to Avoid

Avoid reciting memorized definitions without practical context. Never dismiss non-functional requirements such as security (CSRF, injection, token rotation), observability (logging, metrics), and accessibility (ARIA, semantic standards). Always ask clarifying scope questions before writing complex implementations.

Continuous learning: Practice daily, mark completed questions as learned, and revisit difficult concepts.Explore All Interview Tracks →

Explore Related Tools

Hand-picked utilities and calculators related to this tool.

Related Tools