Interview Questions
Java Basics
- Difference between HashMap and ConcurrentHashMap
- What are the different types of garbage collectors in Java?
- How does the JVM manage memory, and what is the role of the Heap and Stack?
- Explain the concept of immutability in Java and how it is implemented.
Concurrency
- What is a deadlock?
- How can you ensure that N threads can access N resources without a deadlock?
Questions
- What is Liskov Substitution Principle?
- Distinguish between JDK and JRE
- In OOP, how does abstraction differ from encapsulation?
- Why does Java not support multiple inheritances?
- What is the ‘Diamond of Death’ problem?
- Will finally block execute if you put System.exit () in catch or try block?
- Can you store null keys/ values and duplicate keys/values in a Java HashMap?
- Is Java pass-by-reference or pass-by-value?
- What’s the difference between fail-fast and fail-safe?
- Can you store null keys/ values and duplicate keys/values in a Java HashMap?
- What do System.gc() and Runtime.gc() methods do?
- Distinguish between throw and throws in Java
- Can you override a private method in Java?
- How to notice a memory leak in Java?
- String vs StringBuilder vs StringBuffer