Most important Java Interview Questions
Hey Guys, If you are preparing for Java interviews and looking for most commonly asked interview questions then try to answer below questions it will be a quick recap for you.
I am sharing these questions based out of my interview experience, i have cleared multiple interviews of companies like Paytm, Cisco, InfoEdge
1. Why we have static keyword in Java?
2. Why we create static methods and what are benefits of that?
3. Explain about Checked and Unchecked Exceptions with examples?
4. Can we have try with multiple catch and how actually exception handling works, explain with code snippet?
5. How Hashmap identifies whether Object is unique or not?
6. How to create a synchronized arrayList in java?
7. Why interfaces are there in java explain about different types of interfaces?
8. Difference between Runnable and Callable interface?
9. What is the use of Yield() method in java?
10. How to read a file from a given directory using java?
11. What is concurrentHashMap? Explain about internal working of concurrentHashMap?
12. Explain about internal working of HashMap?
13. What is IdentityHashMap?
14. What is method overriding? Can we override static methods?
15. How to create immutable objects and class in Java.
16. Explain about Singelton Design Pattern with code snippet?
17. How to create a final class in Java?
18. What is difference between deep copy and swallow copy?
19. Explain about failFast and failSafe Iterators?
20. How object class methods internally works?
21. Explain about concurrency?
22. Concurrency vs parallelism java?
23. What is difference between OOPs and Functional Programming?
24. Explain about JVM?
25. How garbage Collector works in Java.
26. What is Inheritance, association and Composition?
27. What is aggregation?
28. What is abstract class? How to call abstract class methods?
29. Difference between abstract class and interface?
30. Why string is Immuatble in Java and what are benefits of that?
31. What is String constant pool which memory it uses?
32. Difference between String vs. StringBuilder vs. StringBuffer?
33. Difference between final finally and finalize?
34. throw vs throws in java?
35. Explain different ways of creating Threads in Java?
36. How Executor Service internally Works?
37. How inter thread communication happens in Java and internally in Executor Service?
38. Explain about Java Collection Framework?
39. ArrayList vs LinkedList in Java?
40. HashMap vs LinkedHashMap?
41. How TreeSet internally works?
42. Comparator vs Comparable in Java?
43. HashMap vs HashTable?
44. Explain about OOPs Concepts?
45. How does Java Manages memory uses? and how it handles memory leaks?
46. Comparator Interface in Java with example?
47. What is PriorityQueue?
48. HashMap remove() method in java?
49. What is the complexity of removing an element from HashMap?
50. Explain about concurrency in Java?
51. What is difference between synchronized and concurrent Collections?
52. How to remove duplicate elements from arrayList?
53. Difference between wait and sleep in Java?
54. What is thread starvation in Java?
55. Coupling and Cohesion in Java?
56. Understand more about Java Garbage Collection and How it internally works?
57. How context switching in Java works?
58. Casting preference for int , float vs double?
59. Convert List to array in Java?
60. HashMap computeIfAbsent() method?
61. What is Marker interface explain with example?
62. What is Java Byte Code?
Java 8 Questions
- Explain Latest features of Java 8?
- What is the uses of Optional in java?
- What changes have been made in Hashmap in Java8?
- What is Stream API?
- What is benefit of using Stream API over normal for loops?
- What is Parallel Stream? How it internally works?
- What improvements have been made in Date Time Api?
- What is default method why it has been introduced in Java8?
- What is Functional Interface?
- Explain about different built in Functional interfaces?
- What is Lambda Expression? what are its usage?
- What is UnaryOperator, Supplier, Consumer, Predicate?
- Does Lambda contains return statement?
- Java 8 Stream findFirst() vs findAny()?
- Remove element from a List that satisfies a given Predicate?
- Stream without terminal Operation?
Solution to above questions I will be posting on next post.
Apart from that go through the tutorials once from javatpoint and gfg, It will given more clear picture of java and then you can easily answer above questions.
Thanks for reading, happy interviewing!!