Java Interview Questions
OOP (Object-Oriented Programming)
1. What is OOP?
2. What are the four main principles of OOP?
3. What is encapsulation?
4. What is inheritance?
5. What is polymorphism?
6. What is abstraction?
7. What is the difference between a class and an object?
8. What is a constructor?
9. What is method overloading?
10. What is method overriding?
Exceptions
11. What is an exception?
12. What is the difference between checked and unchecked exceptions?
13. What is the use of the try-catch block?
14. What is the purpose of the finally block?
15. What is the throw keyword?
16. What is the throws keyword?
17. What is the difference between throw and throws?
18. What is a custom exception?
19. What is the try-with-resources statement?
20. What are runtime exceptions?
Strings
21. What is a String in Java?
22. What is the difference between String, StringBuilder, and StringBuffer?
23. How do you compare two strings in Java?
24. What is the intern method?
25. What is string concatenation?
26. How do you convert a string to an integer?
27. What is the substring method?
28. What is [Link] used for?
29. How do you check if a string contains a specific sequence?
30. What is StringBuilder used for?
Multi-threading
31. What is a thread?
32. What is the difference between Runnable and Thread?
33. How do you create a thread in Java?
34. What is the synchronized keyword?
35. What is a deadlock?
36. What is thread safety?
37. What is the join method?
38. What is the volatile keyword?
39. What are the different states of a thread?
40. What is a thread pool?
Collections
41. What is the Java Collections Framework?
42. What is the difference between List, Set, and Map?
43. What is ArrayList?
44. What is HashSet?
45. What is LinkedList?
46. What is HashMap?
47. What is the difference between HashMap and TreeMap?
48. What is PriorityQueue?
49. What is LinkedHashMap?
50. How do you iterate over a collection?