Here is the list of some useful Java interview questions for experienced Java programmers having experience in range of 2 to 5 years. As an experienced developer you are expected to learn about OOP concepts, Java basics, Java Collection framework, Multi-threading and Concurrency utilities introduced in Java 5 and 6, Debugging Java application, Algorithm and Data structure, Some questions on design patterns, JVM and Garbage collection and couple of puzzles.
Actually its mix of everything you do in your day to day work.
If you are going for Java developer with some exposure on web development you will also be asked about popular Java frameworks like Spring, Hibernate, Struts 2.0 and others.
If you have more than 5 years of experience you can also expect questions about build tools like Maven, ANT and Gradle, Java best practices, Unit testing and JUnit and your experience about solving production issues.
One of the most common question I have faced is talking about the last production problem you have faced and how did you solved it. If you are asked same question, give them step by step detail, right from analyzing problem to tactical fix to strategic solution.
In this article, I am going to share my list of Java Interview questions for Java guys having 2 to 5 years of experience. Since I had similar experience couple of year ago, I know what questions are asked and keeping a list for your own always helps when you start looking for new challenge in your career.
I am not providing answers of these question in this post due to two reasons, questions are quite simple and you guys probably know the answer, second providing answer means I cannot use this post for my own preparation later, which is more important.
Though, I could write another article answering all these question if anyone request or I feel people need it.
By the way, if you are new to Java programming language or want to improve Java skills then you can also checkout following best Java courses to get better:
- The Complete Java Masterclass (covers Java 17)
- Java Programming and Software Engineering Fundamentals Specialization Certificate on Coursera
- Java Programming Bootcamp: Zero to Mastery
- The Complete Java Programming Masterclass! [Karpado]
- CodeGym (learn Java by building Games)
These are my favorite online courses and platforms to learn Java from scratch and also build your Java skills. If you need more advanced courses to take your Java skill to next level you can also see following articles:
And, If you like my post, consider subscribing to my newsletter, its FREE and you will not miss any of my post
35 Java Interview Questions for 1 to 2 years Experienced
This list contains questions from different topics e.g. OOP concepts, multi-threading and concurrency, Java collections, Web services, Spring, Hibernate, Database and JDBC, it doesn’t cover all topics you need to prepare.
I will add few more topics later when I have some time, for now, try to answer these questions without doing Google :)
1. Java Interview questions on OOP Concepts
- What is difference between loose coupling and tight coupling?
- What is difference between cohesion and coupling?
- What is Liskov Substitution principle? Can you explain with example?
- What is difference between abstract class and interface in Java?
- What is difference between composition, aggregation and association?
2. Java Interview questions on Collections
- Difference between List, Set and Map in Java?
- Difference between synchronized and concurrent collection in Java?
- How get method of HashMap works in Java?
- How ConcurrentHashMap is different than Hashtable? How it achieve thread-safety?
- When to use LinkedList over ArrayList in Java?
3. Java Interview questions on Concurrency
- How notify and notifyAll work, and the difference between them. Why prefer notifyAll to notify?
- What is a race condition and how do you avoid it?
- What is a deadlock and how do you avoid it?
- What are some of the high-level concurrency classes provided by java.util.concurrent and how do they work?
- Can you implement producer consumer solution in Java?
4. Java Interview questions on Database
- How do you prevent SQL injection attacks?
- What is difference between WHERE and HAVING clause?
- What are transactions? What is ACID?
- Difference between truncate, delete and drop clause in SQL?
- What are window functions? how they work?
5. Java Interview questions on Hibernate
- When is it better to use plain SQL instead of ORM?
- Difference between sorted and ordered collection?
- How second level cache works?
- What is difference between save() and persist()?
- What is difference between Hibernate and MyBatis?
6. Java Interview questions on Web Services and Microservices
- What is the difference between SOAP-based web services and REST-based web services?
- What is SOAP Envelope?
- How to implement security in RESTful web service?
- What is Payload in REST?
- What is Microservices?
- What is difference between Microservices and REST?
- What is difference between Monolithic and Microservices?
hint — development, one vs many, latency, deployment - What problem does SAGA pattern solve?
hint — distributed transactions - What is service discovery in Microservices?
- What are common Microservices Pattern you have used in your project?
Java and Spring Interview Preparation Material
Before any Java and Spring Developer interview, I always use to read the below resources
Grokking the Java Interview: click here
I have personally bought these books to speed up my preparation.
You can get your sample copy here, check the content of it and go for it
Grokking the Java Interview [Free Sample Copy]: click here

If you want to prepare for the Spring Boot interview you follow this consolidated eBook, it also contains microservice questions from spring boot interviews.
Grokking the Spring Boot Interview
You can get your copy here — Grokking the Spring Boot Interview

Thank you guys for now. You can find the answers in web easily but if there are enough interest, I can also update the post. Let me know if you have also asked these questions before. If anyone knows answer, can also post as comment.
Good luck for your Java Interview.
By the way, if you are new to Java programming language or want to improve Java skills then you can also checkout following best Java courses to get better:
- The Complete Java Masterclass (covers Java 17)
- Java Programming and Software Engineering Fundamentals Specialization Certificate on Coursera
- Java Programming Bootcamp: Zero to Mastery
- The Complete Java Programming Masterclass! [Karpado]
- CodeGym (learn Java by building Games)
These are my favorite online courses and platforms to learn Java from scratch and also build your Java skills. If you need more advanced courses to take your Java skill to next level you can also see following articles:
Other Microservices and Java articles you may like
And, If you like my post, consider subscribing to my newsletter, its FREE and you will not miss any of my post
No comments:
Post a Comment
Feel free to comment, ask questions if you have any doubt.