0% found this document useful (0 votes)
2 views3 pages

Java Questionn

Uploaded by

pashyadvn
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Java Questionn

Uploaded by

pashyadvn
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Core Java + OOP Questions (No Answers)

Core Java Fundamentals


1. What is the difference between JDK, JRE, and JVM?
2. How does the Java compiler and JVM work together to run a program?
3. What are primitive data types in Java?
4. Explain pass-by-value vs pass-by-reference in Java.
5. What is the difference between == and .equals()?
6. What are wrapper classes? Why are they needed?
7. Explain autoboxing and unboxing.
8. What are access modifiers in Java?
9. Describe the Java memory model (stack vs heap).
10. How does garbage collection work in Java?
11. Difference between final, finally, and finalize().
12. Explain the role of static (variables, methods, blocks).
13. What are String, StringBuilder, and StringBuffer?
14. How are String objects immutable?
15. Difference between == and compareTo() for strings.
16. What is a package? Why do we use packages?
17. Explain import statements and classpath.
18. What is the default value of instance variables?
19. What are varargs (...) and how are they used?
20. Difference between checked, unchecked, and errors.
Object-Oriented Programming (OOP)
21. Define a class and an object in your own words.
22. What is encapsulation? How do getters/setters relate?
23. Explain inheritance and the “is-a” relationship.
24. What is polymorphism? Give compile-time vs runtime examples.
25. What is abstraction? How is it implemented in Java?
26. Difference between abstract classes and interfaces.
27. Can Java support multiple inheritance? How?
28. Explain method overloading vs overriding.
29. What is dynamic method dispatch?
30. Explain constructor overloading and constructor chaining.
31. How does the super keyword work?
32. How does the this keyword work?
33. What is a nested (inner) class?
34. Explain anonymous inner classes and where they’re useful.
35. Difference between composition and inheritance.
36. What are Java’s object class methods (e.g., toString(),
hashCode(), equals())?
37. Why override hashCode() when overriding equals()?
38. What is a singleton class? How would you design one?
39. What is an immutable class? How to create one?
40. Difference between shallow copy and deep copy.
Collections & Generics
41. Difference between ArrayList, LinkedList, HashSet, TreeSet.
42. How does a HashMap work internally?
43. Difference between HashMap and Hashtable.
44. What is the Map interface?
45. What is the difference between fail-fast and fail-safe iterators?
46. What are generics? Benefits of using them?
47. What is type erasure in generics?
48. How do wildcards (?, <? extends>, <? super>) work?
49. How to create an immutable list or map?
50. Explain Comparable vs Comparator.
Exceptions & Handling
51. Difference between checked and unchecked exceptions.
52. How do you create a custom exception?
53. What is try-with-resources?
54. Explain the order of execution for try, catch, finally.
55. What happens if there is a return statement inside try and
finally?
Concurrency & Multithreading (Basics)
56. Difference between process and thread.
57. How do you create a thread (Runnable vs Thread class)?
58. Explain thread states and the lifecycle.
59. What are synchronized methods and synchronized blocks?
60. Difference between wait(), notify(), and notifyAll().
61. What is the difference between sleep() and wait()?
62. How do you achieve thread safety?
63. What is a deadlock? How can it occur?
64. What are the benefits of ExecutorService over manually creating
threads?
65. Difference between ConcurrentHashMap and HashMap.
Java Language & Features
66. What is the difference between interface default methods and
abstract methods?
67. What are lambda expressions?
68. What are functional interfaces?
69. Explain the Java Stream API.
70. What is method reference (::)?
71. How does optional (Optional<T>) help avoid null checks?
72. What is the difference between var (Java 10) and normal type
declarations?
73. How does the module system (Java 9+) work?
74. What is record type (Java 16)?
Miscellaneous
75. Difference between JIT compilation and interpretation.
76. What is reflection?
77. Explain serialization and deserialization.
78. How to create a deep clone of an object?
79. What is the difference between shallow copy and deep copy?
80. Explain the difference between volatile and synchronized.
81. What is immutability and why is it important in multithreading?
82. Describe memory leaks in Java and how to avoid them.
83. What are design patterns commonly used in Java?
84. How does the garbage collector know which objects to reclaim?
85. What are common pitfalls in overriding equals()?
86. Difference between eager and lazy initialization.
87. Explain dependency injection in the context of Java.
88. What are enums? Why are they more powerful than constants?
89. How to use varargs with method overloading?
90. What are marker interfaces (e.g., Serializable)?

You might also like