Disclosure: This article may contain affiliate links. When you purchase, we may earn a commission.

Thursday, July 21, 2022

10 Advanced Core Java Interview questions for Experienced Programmers

Java interview questions for Senior and Experienced programmer
Java is very big and there is no way to prepare completely for any core java interview but there is a level of the question that depends upon your experience, if you are fresher then questions asked in Java interview are mostly based on fundamentals like Iterator vs Enumeration in Java, Why main is public static and void or maybe ArrayList vs LinkedList in Java. Things changes when you apply for a senior developer, Technical lead, or Team Lead Java position, questions asked on that level are more advanced and less popular among Java circles, you may be asked questions from design pattern, questions from multi-threading, Collections, and even asked to write code, design classes and prepare JUnit tests. 

In this Java article, I will share some advanced Core Java interview questions which appear in Senior level interviews mostly on 4 to 6 years and 6 to 8 years of experience.

One important thing to note is that you can not clear the interview by just mugging the answers to these questions because the interviewer is most likely asked you follow-up questions based upon your response and the only way to get through it is to understand the topic well.



10 Core Java interview questions for senior developers and Tech lead

Here is my list of questions which is worth preparing if you are going for a core java interview for a senior position, these questions are mostly based upon Garbage collection, Concurrency, Collections, design, Coding, and testing.


1. How does ConcurrentHashMap work in Java? 2. is ConcurrentHashMap is thread-safe? (answer)

3. Can we replace Hashtable with ConcurrentHashMap without external synchronization? (answer)
As you see there are multiple questions in this category, those are mostly follow-up and can be answered if you understand ConcurrentHashMap well. you can see this article about Hashtable and ConcurrentHashMap to learn more.


4. What is CountDownLatch in Java?
It's an advanced concurrency utility that allows one thread to wait for other threads until the count reaches zero. For example, the Application thread starts 4 other threads to download user data, product data, customer data, and market data. Application thread until all thread complete their job. Every thread once they are complete, call the countDown method which decreases count by 1. This way, the main thread or application thread starts when all thread completed their job and the count is zero. 


5. What is CyclicBarrier in Java?
CyclicBarrier is similar to CountDownLatch, the only difference is that application thread until all thread reaches to barrier instead of the count reaches to zero. You cannot reuse the latch but you can reuse the barrier in Java. 


6. What is the difference between CountDownLatch and CyclicBarrier in Java?
Concurrency is a favorite topic on advanced core java interviews and it's expected from experienced and senior Java developers to have a good understanding of multi-threading and concurrency API in Java. See these posts about CountDownLatch in Java and the Difference between CountDowntLatch and CyclicBarrier in Java.

10 Advanced Core Java Interview questions for Experienced Programmer



7. What is Race condition? Have you faced any race conditions? 


8. What is deadLock in Java? Write code to avoid deadlock in Java?
Raced conditions and deadlock are major challenges while writing high-performance concurrent Java applications and hands-on experience of dealing with synchronization and concurrency issues expected from a senior and experienced Java programmer. Refer to how to avoid deadlock in Java and What is a race condition in Java for more details.


9. What is PermGen space? or Meta space in Java?

10. What is a memory leak in Java?

11. What is OutOfMemoryError in PermGen or MetaSpace mens? How do you solve those kind of errors? what would be your process and which tools will you use?

12. What is the difference between NoClassDefFoundError and ClassNotFoundException in Java?
These are some questions related to Errors and Exceptions in Java, OutOfMemoryError and NoclassDefFoundError are the most common yet dreaded errors in Java. see the links for more details.

You can also find answers to these questions by searching on google, the key point is to understand it deeply.


Related Interview Questions from Java67 blog

Thanks for reading this article so far. If you like these Java interview questions or have seen them on your telephonic round of interviews, then please share this post with your friends and colleagues on Facebook, Twitter, Email, etc. If you have any questions or feedback, please drop a note.

All the best Guys

2 comments:

  1. Really good questions! Thanks a lot

    ReplyDelete
  2. In my opinion, there is no point asking simple questions to experienced professionals. I would rather prefer to ask fundamental in depth, practical issued faced by enterprise application and how have they solved them in past. You can also quiz them on design, coding, best practices and more important bad practices to avoid. If someone has decent experience in Java, he definitely knows that why comparing String using == is bad or why using float or double for price can create lot of problems of precision, accuracy and rounding.

    ReplyDelete

Feel free to comment, ask questions if you have any doubt.