Java is very big and there is no way to prepare completely for any core java interview but there is a level of question depends upon your experience, if you are fresher than questions asked in Java interview are mostly based on fundamentals like Iterator vs Enumeration in Java, Why main is public static and void or may be ArrayList vs LinkedList in Java. Things changes when you apply for senior developer, Technical lead or Team Lead Java positions, 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 is 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 interview by just mugging answers of these question because interviewer is most likely asked you follow-up question based upon your response and only way to get through it is to understand the topic well.
10 core Java interview question for senior developers and TechLeadHere are my list of questions which is worth preparing if you are going for core java interview for senior position, these questions are mostly based upon Garbage collection , Concurrency, Collections, design, Coding and testing.
How does ConcurrentHashMap works in Java ?
is ConcurrentHashMap is thread-safe?
Can we replace Hashtable to ConcurrentHashMap without external synchronization?
As you see there are multiple question in this category, those are mostly followup and can be answered if you understand ConcurrentHashMap well. you can see this article about Hashtable and ConcurrentHashMap to learn more.
What is CountDownLatch in Java?
What is CyclicBarrier in Java?
What is difference between CountDownLatch and CyclicBarrier in Java?
Concurrency is favorite topic on advanced core java interviews and its expected from experienced and senior Java developers to have good understanding of multi-threading and concurrency API in Java. See these post about CountDownLatch in Java and Difference between CountDowntLatch and CyclicBarrier in Java.
What is Race condition ? Have you faced any race condition?
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 issue expected from a senior and experience Java programmer. Refer how to avoid deadlock in Java and What is race condition in Java for more details.
What is PermGen space ?
What is memory leak in Java?
What is OutOfMemoryError in PermGen mens?
What is difference between NoClassDefFoundError and ClassNotFoundException in Java?
These are some questions related to Errors and Exceptions in Java, OutOfMemoryError and NoclassDefFoundError are most common yet dreaded errors in Java. see the links for more details.
You can also find answers of these questions by searching on google, key point is to understand it deeply.