Java experienced interview questions

Kiran Kumar
2 min readJan 16, 2022


  1. What do you know about SOLID principles
  2. Why String class is immutable ?
  3. How can you created your own immutable class ?
  4. What is the use of implementing hashcode() and equals() method?
  5. What is the difference b/w hashcode() and equals() method?
  6. Do you use caching mechanism. What type of caching mechanisms you have implemented ?
  7. What is the exception? how many types of exceptions are there ?
  8. How to implement custom exception ?
  9. What is functional interface ?
  10. Is comparable/comparator functional interface ?
  11. Why can’t we use Redis as database over RDMBS ?
  12. what is the difference between stream and parallel streams?

Design patterns

  1. What is a singleton design pattern?
  2. What is the difference between Factory and Builder design pattern ?
  3. what is the strangler design pattern ?

Caching mechanism:

  1. What is ehcache? How do you implement it ?
  2. We can talk about Redis cache , if you know about it every well.

Threads :

  1. what if multiple thread accessing the same service at a time ? how to avoid congestion in this situation?
  2. Write a program to thread prints even numbers and another thread with odd numbers ? What happens if its synchronization is implemented with this scenario ?
  3. What is the difference between runnable and callable in thread?


  1. what is the configuration you add to activate @Autowired injection in spring project ?
  2. When two interfaces have same method declaration ? how to decide which to be used first ?
  3. what is the use of @Restcontroller vs @Controller?


1.What is the default partitioning available in database? you tune up SQL queries and any best practices suggest ?

3.What are conditional indexes ? many types of partitions we can do ?

6. how do we avoid dead tuples ?


1.What are the advantages and disadvantages of microservice?

2.How can convince your client agree for microservices architecture over monolithic services?

3. What is the strangler design pattern ?

4.​Transaction management is a challenge across microservices . how can we resolve this . Specially in BFSI domain where rollback is dependent upon the response from other microservice?

5.​How can we implement security between multiple microservices? De we use the restTemplate to send the JWT to the microservice that has the actual userid n password authentication? or any other way?

6. how do maintain user data across all microservices (consider you have N number of microservices )

7. Is Microservices is stateful or stateless architecture?

8. what is service mesh ?when to use service mesh in microservice?



Kiran Kumar

Technophile with 10 years experience in IT industry | Java Lead cum Architect