200+ Java Interview Questions

Looking for Java Interview Questions? Here is a list of 200+ Java Interview Questions that might help you ace that interview you’re heading to.

This list is a comprehensive list for freshers or experienced folks (in no particular order). Do let us know if you don’t find an answer to anything and we’ll help you with that as well.

Butm before that, here’s the list of java interview questions for you:

  1. Explain JVM, JRE, and JDK?
  2. Explain public static void main(String args[])
  3. Why Java is platform-independent?
  4. Why java is not 100% Object-oriented?
  5. What are wrapper classes?
  6. What are constructors in Java?
  7. What is singleton class and how can we make a class singleton?
  8. What is the difference between Array list and vector?
  9. What is the difference between equals() and = =?
  10. What are the differences between Heap and Stack Memory?
  11. What is Polymorphism?
  12. What is runtime polymorphism or dynamic method dispatch?
  13. What is the difference between abstract classes and interfaces?
  14. What is method overloading and method overriding?
  15. What is multiple inheritances? Is it supported by Java?
  16. What is an association?
  17. What do you mean by aggregation?
  18. What is composition in Java?
  19. What is a servlet?
  20. What are the differences between gettingGet and Post methods?
  21. What is Request Dispatcher?
  22. What are the differences between forward() method and sendRedirect() methods?
  23. What is the life-cycle of a servlet?
  24. How do cookies work in Servlets?
  25. What are the differences between ServletContext vs ServletConfig?
  26. What are the JDBC API components?
  27. What is the role of the JDBC DriverManager class?
  28. What is JDBC Connection interface?
  29. What is the purpose of the JDBC ResultSet interface?
  30. What is JDBC ResultSetMetaData interface?
  31. What is JDBC DatabaseMetaData interface?
  32. What do you mean by batch processing in JDBC?
  33. What is the difference between execute, executeQuery, executeUpdate?
  34. What is Spring?
  35. Name the different modules of the Spring framework.
  36. List some of the important annotations in annotation-based Spring configuration.
  37. Explain Bean in Spring and List the different Scopes of Spring bean.
  38. Explain the role of DispatcherServlet and ContextLoaderListener.
  39. What are the differences between constructor injection and setter injection?
  40. What is auto wiring in Spring? What are the auto wiring modes?
  41. What are some of the important Spring annotations which you have used?
  42. How to integrate Spring and Hibernate Frameworks?
  43. What is Hibernate Framework?
  44. Explain Hibernate architecture?
  45. What are the differences between get and load methods?
  46. What are the advantages of Hibernate over JDBC?
  47. What are the life-cycle methods for a JSP?
  48. What are the JSP implicit objects?
  49. What are the differences between include directive and include action?
  50. How to disable caching on the back button of the browser?
  51. What are the different tags provided in JSTL?
  52. How to disable session in JSP?
  53. How to delete a Cookie in a JSP?
  54. Explain the jspDestroy() method.
  55. How is JSP better than Servlet technology?
  56. Why should we not configure JSP standard tags in web.xml?
  57. What is the difference between Error and Exception?
  58. How can you handle Java exceptions?
  59. What are the differences between Checked Exception and Unchecked Exception?
  60. What purpose do the keywords final, finally, and finalize fulfill?
  61. What are the differences between throw and throws?
  62. What is the exception hierarchy in java?
  63. How to create a custom Exception?
  64. What are the important methods of Java Exception Class?
  65. What are the differences between processes and threads?
  66. What is a finally block? Is there a case when finally will not execute?
  67. What is synchronization?
  68. Can we write multiple catch blocks under a single try block?
  69. What are the important methods of Java Exception Class?
  70. What is difference between JDK,JRE and JVM?
  71. How many types of memory areas are allocated by JVM?
  72. What is JIT compiler?
  73. What is a platform?
  74. What is the main difference between the Java platform and other platforms?
  75. What gives Java its ‘write once and run anywhere’ nature?
  76. What is classloader?
  77. Is Empty .java file name a valid source file name?
  78. Is delete, next, main, exit or null keyword in java?
  79. If I don’t provide any arguments on the command line, then the String array of Main method will be empty or null?
  80. What if I write static public void instead of the public static void?
  81. What is the default value of the local variables?
  82. What is the difference between an object-oriented programming language and object-based programming language?
  83. What will be the initial value of an object reference which is defined as an instance variable?
  84. What is constructor?
  85. What is the purpose of default constructor?
  86. Does constructor return any value?
  87. Is constructor inherited?
  88. Can you make a constructor final?
  89. What is a static variable?
  90. What is a static method?
  91. Why the main method is static?
  92. What is a static block?
  93. Can we execute a program without main() method?
  94. What if the static modifier is removed from the signature of the main method?
  95. What is the difference between static (class) method and instance method?
  96. What is this in java?
  97. What is Inheritance?
  98. Which class is the superclass for every class?
  99. Why multiple inheritances are not supported in java?
  100. What is composition?
  101. What is the difference between aggregation and composition?
  102. Why Java does not support pointers?
  103. What is super in java?
  104. Can you use this() and super() both in a constructor?
  105. What is object cloning?
  106. What is method overloading?
  107. Why method overloading is not possible by changing the return type in java?
  108. Can we overload the main() method?
  109. What is method overriding:
  110. Can we override the static method?
  111. Why we cannot override static method?
  112. Can we override the overloaded method?
  113. Difference between method Overloading and Overriding.
  114. Can you have virtual functions in Java?
  115. What is the covariant return type?
  116. What is the final variable?
  117. What is the final method?
  118. What is the final class?
  119. What is the blank final variable?
  120. Can we initialize a blank final variable?
  121. Can you declare the main method as final?
  122. What is Runtime Polymorphism?
  123. Can you achieve Runtime Polymorphism by data members?
  124. What is the difference between static binding and dynamic binding?
  125. What is abstraction?
  126. What is the difference between abstraction and encapsulation?
  127. What is an abstract class?
  128. Can there be any abstract method without abstract class?
  129. Can you use abstract and final both with a method?
  130. Is it possible to instantiate the abstract class?
  131. What is the interface?
  132. Can you declare an interface method static?
  133. Can an Interface be final?
  134. What is marker interface?
  135. What is the difference between abstract class and interface?
  136. Can we define private and protected modifiers for variables in interfaces?
  137. When can an object reference be cast to an interface reference?
  138. What is a package?
  139. Do I need to import java?lang package any time? Why?
  140. Can I import the same package/class twice? Will the JVM load the package twice at runtime?
  141. What is a static import?
  142. What is Exception Handling?
  143. What is the difference between Checked Exception and Unchecked Exception?
  144. Is it necessary that each try block must be followed by a catch block?
  145. What is finally block?
  146. Can finally block be used without a catch?
  147. Is there any case when finally will not be executed?
  148. What is the difference between throw and throws?
  149. Can an exception be rethrown?
  150. Can subclass overriding method declare an exception if the parent class method doesn’t throw an exception?
  151. What is exception propagation?
  152. What is the meaning of immutable in terms of String?
  153. Why string objects are immutable in java?
  154. How many ways we can create the string object?
  155. How many objects will be created in the following code?
  156. Why java uses the concept of string literal?
  157. How many objects will be created in the following code?
  158. What is the basic difference between string and StringBuffer object?
  159. What is the difference between StringBuffer and StringBuilder?
  160. How can we create immutable class in java?
  161. What is the purpose of the toString() method in java?
  162. What is a nested class?
  163. Is there any difference between nested classes and inner classes?
  164. Can we access the non-final local variable, inside the local inner class?
  165. What is a nested interface?
  166. Can a class have an interface?
  167. Can an Interface have a class?
  168. What is Garbage Collection?
  169. What is gc()?
  170. What is the purpose of the finalize() method?
  171. Can unreferenced objects be referenced again?
  172. What kind of thread is the Garbage collector thread?
  173. What is the difference between final, finally and finalize?
  174. What is the purpose of the Runtime class?
  175. How will you invoke any external process in Java?
  176. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
  177. What an I/O filter?
  178. What is serialization?
  179. What is Deserialization?
  180. What is transient keyword?
  181. What is Externalizable?
  182. What is the difference between Serializable and Externalizable interface?
  183. How do I convert a numeric IP address like 192.18.97.39 into a hostname like java.js.com?
  184. What is a reflection?
  185. Can you access the private method from outside the class?
  186. What are wrapper classes?
  187. What is a native method?
  188. What is the purpose of the System class?
  189. What comes to mind when someone mentions a shallow copy in Java?
  190. What is a singleton class?
  191. Which containers use a border layout as their default layout?
  192. Which containers use a FlowLayout as their default layout?
  193. What are peerless components?
  194. Is the difference between a Scrollbar and a ScrollPane?
  195. What is a lightweight component?
  196. What is a heavyweight component?
  197. What is an applet?
  198. Can you write a Java class that could be used both as an applet as well as an application?
  199. What is Locale?
  200. How will you load a specific locale?
  201. What is a JavaBean?
  202. Can RMI and Corba based applications interact?

Did these help you? Let us know in comments!

Leave a Reply 2

Your email address will not be published. Required fields are marked *


100 Python Interview Questions You Should Prepare For

100 Python Interview Questions You Should Prepare For

[…] to ace your Java interview? Here is a list of 200+ Java interview questions to help you […]

50+ Project Manager Interview Questions

50+ Project Manager Interview Questions

[…] techniques like SEO. Learn how you can easily prepare for any hardballs thrown at you with these Java interview questions and SEO interview […]