Java Interview Questions

1) Explain OOP Concepts
2) Differences between abstract classes and interfaces?
3) What is the difference between iterator and enumeration in java?
4) Composition vs Inheritance
5) Difference between method overloading and overriding
6) What are the access modifiers you know? What does each one do?
7) Can an Interface implement another Interface?
8) What is Polymorphism? What is Inheritance?
9) Explain Generics in Java?
10) Stack vs Queue
11) HashMap vs Set
12) HashSet vs TreeSet
13) What is Java PriorityQueue?
14) How is String class implemented? Why was it made immutable?
15) What does it means to say that a String is immutable?
16) What is String.intern()? When and why should it be used?
17) Can you list primitive types in Java?
18) What is the difference between an Integer and int?
19) What is Autoboxing and Unboxing?
20) Typecast in Java?
21) Do objects get passed by reference or value in Java? Elaborate on that.
22) What is the difference between instantiation and initialization of an object?
23) What the difference between local, instance and class variables?
24) What is garbage collector? How does it work?
25) What is memory leak and how does Java handle it?
26) What are strong, soft, weak and phantom references in Java?
27) What does the keyword synchronized mean?
28) What is a ThreadPoolExecutor?
29) What is volatile modifier?
30) How does the try{} catch{} finally{} works?
31) What is the difference between a Checked Exception and an Un-Checked Exception?
32) What is serialization? How do you implement it?
33) What is transient modifier?
34) What are anonymous classes?
35) What is the difference between using == and .equals on an object?
36) What is the hashCode() and equals() used for?
37) Why would you not call abstract method in constructor?
38) When would you make an object value final?
39) What are these final, finally and finalize keywords?
40) What does the static word mean in Java?
41) Can a static method be overridden in Java?
42) When is a static block run?
43) What is reflection?
44) How is a StringBuilder implemented to avoid the immutable string allocation problem?
45) Difference between StringBuffer and StringBuilder?
46) What’s the difference between an Enumeration and an Iterator?
47) What is the difference between fail-fast and fail-safe iterators in Java?
48) What do you mean by platform independence of Java?
49) What is the difference between JDK and JVM?
50) Which class is the superclass of all classes?
51) Why Java doesn’t support multiple inheritance?
52) Why Java is not pure Object Oriented language?
53) What is the importance of main method in Java?
54) Can we overload main method?
55) Can we have multiple public classes in a java source file?
56) What is Java Package and which package is imported by default?
57) What are access modifiers?
58) What is final keyword?
59) What is static keyword?
60) Can we declare a class as static?
61) What are Wrapper classes?
62) What is Enum in Java?
63) What is composition in java?
64) What does super keyword do?
65) What is this keyword?
66) What is break and continue statement?
67) What is default constructor?
68) Can we have try without catch block?
69) What is the use of System class?
70) What is instanceof keyword?
71) What is difference between Heap and Stack Memory?

2 comments: