java interview questions

  1. What is finally and finalize in java?
  2. Can we declare a class as static?
  3. What is static import?
  4. What is try-with-resources in java?
  5. What is multi-catch block in java?
  6. What is static block?
  7. What is inner class in java?
  8. What is anonymous inner class?
  9. What is Classloader in Java?
  10. What are different types of classloaders?
  11. What is ternary operator in java?
  12. What does super keyword do?
  13. What is break and continue statement?
  14. What is this keyword?
  15. What is default constructor?
  16. What is Java Reflection API? Why it’s so important to have?
  17. What is composition in java?
  18. What is the benefit of Composition over Inheritance?
  19. How to sort a collection of custom Objects in Java?
  20. Can we have try without catch block?
  21. What is Garbage Collection?
  22. What is Serialization and Deserialization?
  23. How to run a JAR file through command prompt?
  24. What is the use of System class?
  25. What is instanceof keyword?
  26. Can we use String with switch case?
  27. What will be the output of following programs?
  28. What is meant by implicit objects and what are they ?
  29. What are Expressions ?
  30. What are Decalarations ?
  31. What is Function Overriding and Overloading in Java ?
  32. What is a Constructor, Constructor Overloading in Java and Copy-Constructor ?
  33. Does Java support multiple inheritance ?
  34. What is the difference between an Interface and an Abstract class ?
  35. What are pass by reference and pass by value ?
  36. What is the difference between processes and threads ?
  37. What is the importance of main method in Java?
  38. What is overloading and overriding in java?
  39. Can we overload main method?
  40. Can we have multiple public classes in a java source file?
  41. What is Java Package and which package is imported by default?
  42. What are access modifiers?
  43. What is final keyword?
  44. What is static keyword?
  45. What is an interface?
  46. What is an abstract class?
  47. What are JSP actions ?
  48. What are Directives ? What are the different types of Directives available in JSP ?
  49. What are the advantages of JSP ?
  50. What is the Difference between JDK and JRE ?
  51. What are Wrapper classes?
  52. What is Enum in Java?
  53. What is Java Annotations?
  54. What are Scriptlets ?
  55. What does the “static” keyword mean ? Can you override private or static method in Java ?
  56. What are the basic interfaces of Java Collections Framework ?
  57. Why Collection doesn’t extend Cloneable and Serializable interfaces ?
  58. What is an Iterator ?
  59. What differences exist between Iterator and ListIterator ?
  60. What is difference between fail-fast and fail-safe ?
  61. How HashMap works in Java ?
  62. What is the importance of hashCode() and equals() methods ?
  63. What differences exist between HashMap and Hashtable ?
  64. What are the important features of Java 8 release?
  65. What do you mean by platform independence of Java?
  66. What is JVM and is it platform independent?
  67. What is the difference between JDK and JVM?
  68. What is the difference between JVM and JRE?
  69. Which class is the superclass of all classes?
  70. Why Java doesn’t support multiple inheritance?
  71. Why Java is not pure Object Oriented language?
  72. What is difference between path and classpath variables?
  73. What is the difference between abstract class and interface?
  74. Can an interface implement or extend another interface?
  75. What is Marker interface?
  76. Can you access non static variable in static context ?
  77. What are the Data Types supported by Java ? What is Autoboxing and Unboxing ?
  78. Explain different ways of creating a thread. Which one would you prefer and why ?
  79. Explain the available thread states in a high-level.
  80. What is servlet chaining?
  81. What is a serverside include?
  82. What is meant by a web application?
  83. What is the difference between doget() and do post()?
  84. Explain the life cycle of a servelt?
  85. What is the difference between genericservlet and httservlet?
  86. What is the differce an applet and a servlet?
  87. Explain the architechture of a servlet
  88. What is a servlet?
  89. Explain serialization and deserilization
  90. Explain marshalling and demarshalling
  91. What is the applet class loader, and what does it provide ?
  92. What is the applet security manager, and what does it provide ?
  93. What is the difference between a Choice and a List ?
  94. What is a layout manager ?
  95. What is the difference between a Scrollbar and a JScrollPane ?
  96. Which Swing methods are thread-safe ?
  97. Name three Component subclasses that support painting.
  98. What is the purpose of using RIMS security manager in RMI?
  99. WhaT is DGC? And how does it work?
  100. what is the role of stub in RMI?
  101. What are the steps involved to make a RML pgrogramme?
  102. what is difference between using bind() and rebind()method of naming class?
  103. what is meant by binding in RMI?
  104. What is the role of the java.rmi.Naming Class?
  105. what is the role of Remote Interface in RMI?
  106. What are layers of RMI Architecture?
  107. what does connection pooling mean?
  108. whaat is the use CallableStatement?
  109. What is the desing pattern that Java uses for all swing components?
  110. what iadvantage do java’layout managers provide over traditional windowing systems?
  111. how can a GUI component handleits own events?
  112. What is the difference between an Applet and a Java Application ?
  113. What are the restrictions imposed on Java applets ?
  114. What are untrusted applets ?
  115. What is the difference between applets loaded over the internet and applets loaded via the file system ?
  116. What is clipping ?
  117. What is JVM ? Why is Java called the “Platform Independent Programming Language” ?
  118. What is the difference between a MenuItem and a CheckboxMenuItem ?
    how are jsp requests handled?
  119. what is a jsp page?
  120. what is url encoding and url decoding?
  121. what is difference between sendredirect and forward methods?
  122. what is http tunneling?
  123. which protocol will be used by browser and servlet to communicate?
  124. what is the strcute of the http reponsse?
  125. how do you find out what client machine is maing a rquest to your servlet?
  126. What is the difference between throw and throws ?
  127. What is the importance of finally block in exception handling ?
  128. What will happen to the Exception object after exception handling ?
  129. How does finally block differ from finalize() method ?
  130. What is an Applet ?
  131. Explain the life cycle of an Applet.
  132. What happens when an applet is loaded ?
  133. Name the method which is used to prepare a Callablestatement?
  134. What is the advantage of preparedStatement over Statement?
  135. Explain the role of driver in JDBC?
  136. What is JDBC?
  137. What is the difference between Exception and Error in java ?
  138. What is the relationship between an event listener interface and an event adapter class?
  139. What is the relationship between clipping and repainting?
  140. What is the difference between a Window and a Frame ?
  141. How are the elements of aGRIDBagLayout orgranized?
  142. How are the elements of border layout orgranized?
  143. What is the difference between Serial and Throughput Garbage collector ?
  144. When does an Object becomes eligible for Garbage collection in Java ?
  145. Does Garbage collection occur in permanent generation space in JVM ?
  146. What are the two types of Exceptions in Java ? Which are the differences between them ?
  147. What is the difference between HashSet and TreeSet ?
  148. What is the purpose of garbage collection in Java, and when is it used ?
  149. What does System.gc() and Runtime.gc() methods do ?
  150. When is the finalize() called ? What is the purpose of finalization ?
  151. If an object reference is set to null, will the Garbage Collector immediately free the memory held by that object ?
  152. What is structure of Java Heap ? What is Perm Gen space in Heap ?
  153. What is Java Priority Queue ?
  154. What’s the difference between Enumeration and Iterator interfaces 
  155. what is difference between Array and ArrayList ? When will you use Array over ArrayList ?
  156. What is difference between ArrayList and LinkedList ?
  157. What is Comparable and Comparator interface ? List their differences.
  158. How does thread synchronization occurs inside a monitor ? What levels of synchronization can you apply ?
  159.   What’s a deadlock ?
  160. How do you ensure that N threads can access N resources without deadlock ?
  161. What is the difference between a synchronized method and a synchronized block ?
  162. What do you know about the big-O notation and can you give some examples with respect to different data structures ?
  163. What is the tradeoff between using an unordered array versus an ordered array ?
  164. What are some of the best practices relating to the Java Collection framework ?