Java Interview Questions

1. Core Java

  1. CopyOnWriteArrayList
  2. Reflection API
  3. Threading
    1. Difference between Process and Thread
    2. Different ways to start a thread
    3. Thread lifecycle/states
    4. Runnable vs Callable
    5. Sleep vs Wait
    6. Wait vs Join
    7. Thread-Safe
    8. ExecuterService
    9. Difference between class lock and object lock?
    10. Best of Java Multithreading Interview Questions
  4. Collections
    1. Collection vs Collections
    2. Hashmap vs ConcurrentHashmap
    3. Set which maintains the order
    4. Hashmap vs HashTable
  5. JVM
    1. Java memory management
    2. Class loader
  6. String
    1. String vs StringBuilder vs StringBuffer
    2. Why String is immutable object ? what happens if it would be a mutable object ?
    3. How to make object as immutable ?
  7. Serialization ?
  8. Comparator vs Comparable
  9. Loop
    1. Break vs Continue
  10. Deep copy vs Shallow copy
  11. Object
    1. Why do we need to override equals() and hashCode() method ? What is the importance of equals() and hashCode() methods ?

2. Microservices

  1. How do you maintain data consistency across multiple services if all services connects to same DB and updates same table simultaneously ?
  2. What are all the design patterns available in microservices ?
  3. What is SAGA design pattern ?

3. Design Patterns

4. Hibernate

  1. Difference between JPA and Hibernate ?
  2. What are all the relationships available in hibernate ?
  3. What are all the caches mechanism available in Hibernate ?
  4. How do you implement second level cache ?
  5. Difference between get and load method ?
  6. How do you initialize hibernate session ?

4. Design Principles

  1. Why do you need design principles ?
  2. What are all the design principles you use in your project ?

5. Spring Boot

6. Spring Framework

  1. What is @Transactional annotation ? What it does ?
  2. What are the types of Isolation levels ?
  3. What are the propagation types ?
  4. What is @RestController

7. Spring security

  1. Explain how security flow works in your project ?
  2. What consists of JWT token ?
  3. What is OAuth mechanism ?
  4. What is OpenId connect ?
  5. Difference between Authentication and Authorization ?

8. DevOps

  1. How do you implement CI/CD in your project ?
  2. What is CI/CD pipeline concept

9. DB

  1. Joins
  2. Unions
  3. Simple queries using rownum
  4. Procedure
  5. Views
  6. Stored Procedure
  7. Performance comparison of SQL queries/views/stored procedures
  8. Aggregate functions

10. Java coding questions

  1. I have of a list of employees. I want to retrieve only the employees from dept 1. Write a program in java 8.

11. UI

  1. Difference between Angular and React.

12. Functional Programming

  1. Difference between object oriented and functional programming