Tech 'n' Tech Books


Top Java interview questions

  1. How do I instantiate a bean whose constructor accepts parameters using the useBean tag?
  2. Replacing Characters in a String?
  3. Searching a String?
  4. Connecting to a Database and Strings Handling?
  5. What is a transient variable?
  6. What is the difference between Serializalble and Externalizable interface?
  7. How many methods in the Externalizable interface?
  8. How many methods in the Serializable interface?
  9. How to make a class or a bean serializable?
  10. What is the serialization?
  11. What are synchronized methods and synchronized statements?
  12. What is synchronization and why is it important?
  13. What is the purpose of finalization?
  14. What classes of exceptions may be caught by a catch clause?
  15. What is the difference between the Reader/Writer class hierarchy and the InputStream/OutputStream class hierarchy?
  16. What happens when a thread cannot acquire a lock on an object?
  17. What restrictions are placed on method overriding?
  18. What restrictions are placed on method overloading?
  19. How does multithreading take place on a computer with a single CPU?
  20. How is it possible for two String objects with identical values not to be equal under the == operator?
  21. How are this() and super() used with constructors?
  22. What class allows you to read objects directly from a stream?
  23. What is the ResourceBundle class?
  24. What interface must an object implement before it can be written to a stream as an object?
  25. What is Serialization and deserialization?
  26. What are the Object and Class classes used for?
  27. Can you write Java code for declaration of multiple inheritance in Java ?
  28. What do you mean by multiple inheritance in C++ ?
  29. Write the Java code to declare any constant (say gravitational constant) and to get its value.
  30. What are the disadvantages of using threads?
  31. Given two tables Student(SID, Name, Course) and Level(SID, level) write the SQL statement to get the name and SID of the student who are taking course = 3 and at freshman level.
  32. What do you mean by virtual methods?
  33. What do you mean by static methods?
  34. What do mean by polymorphism, inheritance, encapsulation?
  35. What are the advantages of OOPL?
  36. How many methods do u implement if implement the Serializable Interface?
  37. Are there any other ‘marker’ interfaces?
  38. What is the difference between instanceof and isInstance?
  39. Why do you create interfaces, and when MUST you use one?
  40. What’s the difference between the == operator and the equals() method? What test does Object.equals() use, and why?
  41. Discuss the differences between creating a new class, extending a class and implementing an interface; and when each would be appropriate.
  42. Given a text file, input.txt, provide the statement required
  43. Name four methods every Java class will have.
  44. What does the “abstract” keyword mean in front of a method? A class?
  45. Does Java have destructors?
  46. Are constructors inherited? Can a subclass call the parent’s class constructor? When?
  47. What synchronization constructs does Java provide? How do they work?
  48. Why “bytecode”? Can you reverse-engineer the code from bytecode?
  49. Does Java have “goto”?
  50. What does the “final” keyword mean in front of a variable? A method? A class?
  51. Access specifiers: “public”, “protected”, “private”, nothing?
  52. What is JDBC? Describe the steps needed to execute a SQL query using JDBC.
  53. What is RMI?
  54. What are native methods? How do you use them?
  55. What does the keyword “synchronize” mean in java. When do you use it? What are the disadvantages of synchronization?
  56. How many different types of JDBC drivers are present? Discuss them.
  57. What is the difference between a Vector and an Array. Discuss the advantages and disadvantages of both?
  58. Describe java’s security model.
  59. Java says “write once, run anywhere”. What are some ways this isn’t quite true?
  60. What is the difference between an Applet and an Application?
  61. How can you force all derived classes to implement a method present in the base class?
  62. What are abstract classes, abstract methods?
  63. What’s the difference between == and equals method?
  64. Describe, in general, how java’s garbage collector works?
  65. What is the difference between StringBuffer and String class?
  66. How can you achieve Multiple Inheritance in Java?
  67. What are interfaces?
  68. What are the main differences between Java and C++?
  69. In Java, You can create a String object as: String str = “abc”; & String str = new String(”abc”); Why cant a button object be created as : Button bt = “abc” Why is it compulsory to create a button object as: Button bt = new Button(”abc”); Why is this not compulsory in String’s case?
  70. Why are Java ARchive (JAR) files important?
  71. What is it reflection (introspection) ? Why is reflection possible in the Java language?
  72. How to make application thread-safe ?
  73. What is it object serialization?
  74. What do you know about networking support in Java?
  75. What you know about Corba implementation in Java?
  76. What is Java Beans?
  77. Compare SWING components to standard AWT.
  78. What is layout manager ? How does it work?
  79. What is the purpose of the toolkit in the Abstract Window Toolkit (AWT)? How does AWT work?
  80. What are the differences between Java & C++ in terms of its features?
  81. Is the ternary operator written x : y ? z or x ? y : z ?
  82. What is the List interface?
  83. What is the difference between an if statement and a switch statement?
  84. What are the problems faced by Java programmers who don’t use layoutmanagers?
  85. What are the two basic ways in which classes that can be run as threads may be defined?
  86. What are synchronized methods and synchronized statements?
  87. Which Component subclass is used for drawing and painting?
  88. What methods are used to get and set the text label displayed by a Buttonobject?
  89. What method must be implemented by all threads?
  90. When is an object subject to garbage collection?
  91. Can an unreachable object become reachable again?
  92. How does a try statement determine which catch clause should be used tohandle an exception?
  93. What are the Object and Class classes used for?
  94. What modifiers may be used with a top-level class?
  95. What is a Java package and how is it used?
  96. What is the purpose of a statement block?
  97. What is the difference between the prefix and postfix forms of the ++ operator?
  98. Can try statements be nested?
  99. To what value is a variable of the boolean type automatically initialized?
  100. What is the difference between a public and a non-public class? 

Top JSP interview questions

  1. Can you make use of a ServletOutputStream object from within a JSP page?
  2. Can a JSP page instantiate a serialized bean?
  3. Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
  4. What is the page directive is used to prevent a JSP page from automatically creating a session?
  5. How do you prevent the Creation of a Session in a JSP Page and why?
  6. How do I include static files within a JSP page?
  7. How can I implement a thread-safe JSP page?
  8. How do I mix JSP and SSI #include?
  9. Can a JSP page process HTML FORM data?
  10. What JSP lifecycle methods can I override?
  11. How do I perform browser redirection from a JSP page?
  12. Is there a way to reference the “this” variable within a JSP page?
  13. Can I stop JSP execution while in the midst of processing a request?
  14. How do I use comments within a JSP page?
  15. How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
  16. How does JSP handle run-time exceptions?
  17. How do I use a scriptlet to initialize a newly instantiated bean?
  18. How can I enable session tracking for JSP pages if the browser has disabled cookies?
  19. How can I declare methods within my JSP page?
  20. How can I set a cookie and delete a cookie from within a JSP page?
  21. Is there a way I can set the inactivity lease period on a per-session basis?
  22. How does a servlet communicate with a JSP page?
  23. How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default?
  24. How do you pass control from one JSP page to another?
  25. How do you restrict page errors display in the JSP page?
  26. How do you call stored procedures from JSP?
  27. How do you connect to the database from JSP?
  28. What is Declaration?
  29. What is difference between scriptlet and expression?
  30. What is jsp:use bean. What are the scope attributes & difference between these attributes?
  31. What are the implicit objects in JSP & differences between them?
  32. What are Custom tags. Why do you need Custom tags. How do you create Custom tag?
  33. What is the difference between include directive & jsp:include action?
  34. What are advantages of JSP?
  35. What is JSP?
  36. Can a single JSP page be considered as a J2EE application?
  37. How to call EJB from JSP.
  38. What is the architecture of JSP?
  39. What is the difference between servlet session and jsp session?
  40. Why should we setContentType() in servlet ?what is the use of that method?
  41. When jsp is compiled into servlet, where the servlet is actually stored(storage location)?
  42. How to generate BAR & PIE Graphs using JSP code…?
  43. What is the diff. b/n declaring members in and declaraing in jspinit() method ?
  44. How to check the value in the text field is not a number
  45. what is the use of extends in jsp…we we want to import a class in current jsp file which i am working how can i do that …if i use extnds for that means how can i do that…pls explain me this
  46. I have a String name & Map m, in my bean class. I have get & set methods on both. To Display the String name, i do The above one works fine. Te below one, displays the entire Map contents I know the KEY, how do i display the VALUE for that KEY
  47. What is the difference between , pagedirective include, action tag include ?
  48. What are the default objects provided by JSP container? Other than page, request, session and context objects.
  49. What is the default scope of jsp tags?
  50. When many Users are browsing the same application at the same time and they click the “Submit” button will many objects be created for each and every User?
  51. What is the difference between Difference between doGet() and doPost()?
  52. How do we perform redirect action without using response.sendRedirect(” “);
  53. A] Is the response.sendRedirect ends the existing session? B] If I logged in to a site ( say a.com) & then in same browser window I type the url for another site (say b.com), then does my session gets ended on first site ( a. com ) ?
  54. How to overwrite the init and destroy method in a jsp page.
  55. Where do we use hidden variables and url rewriting? and wat is the difference between them?
  56. What is the difference between session and cookie ?
  57. How to pass java script array to jsp page?
  58. What is the difference betweeen JSP forward and servlet forward methods?
  59. Where can we find the compiled file of jsp in the directory struture.
  60. How we abort jsp page from a servlet
  61. What is difference between getAttribute() and getParameter()?
  62. What is the diff. b/w PAGE,APPLICATION and SESSION implicit objects of JSP?
  63. Wat is the difference between and in jsp..wen translate into servlet..wer it is stored in servlet..can we create global variables in jsp..if yes then how??
  64. How can i restrict the user from Clicking of Back button in any browser
  65. In one class i stored the key and values in the hashmap.so using key value i have to check wheter the value for key is correct or not.so how to retreive the key and values in jsp page
  66. What is the differnce between application server and web server
  67. What is use of implict Objects?why the container is given those one?
  68. How to delete cookies in JSP?
  69. In Oracle table some fields are “null”.By default it will show as “null” in JSP page text box.But i dont want that. I want as blank textbox.What i can do for that?
  70. In Internet explorer if we give a jsp , How the server will know it has to execute?
  71. How the jsp changes will be effected in servlet file after converting?
  72. When to use struts technology? What type of applications are developed using struts frame work?
  73. What is the need of taglibraries?
  74. Explain online banking system using java.that means i need architecture of online banking system.please sir i want full details
  75. Text in textarea cant be copy by anyone while it is running in the browser (i.e,the text cant be copy and then paste on the other page) give me suggestion?
  76. How can i clear values in sessions. if i open a jsp page it is containing previous values. then i need to open a new page then only i am getting a fresh page
  77. What data is stored in the variable appname when we give the folowing statement String appname=(”manager”.equalsIgnoreCAse(request.getContextPath()))?”/manager”:”/portal”;
  78. Web browser concept using jsp
  79. Why we can’t implement interface in JSP? Why we can only extend classes in JSP?
  80. How can we implement logoutpage using jsp ..? and Is there any method to force the browser to show the same page again and again after logout..?
  81. How to Upload a textfile from JSP to Servlet
  82. My html form contains an INPUT “text” element that accepts Date, i want to catch that date and want to query it using JSP? In short, how can i use that HTML form element with Prepared Statements in JSP?
  83. Types of indexing used in oracle applications ? and when and how we decide to implement indexing to database ?
  84. What is the need of implicit objects?
  85. When we design some login form how we manage security for those forms?which technology used for that purpose?
  86. How Do you implement interface in JSP?
  87. How can initialize interface in JSP?
  88. How do u maintain a Session?
  89. What is the differences between JSP LifeCycle and Servlet LifeCycle?
  90. Can I call an interface in a JSP?
  91. What is the Difference between sendRedirect() and Forward?
  92. I want to place two buttons one for save and one for delete.i am using DispatchAction as controller,how can i find which button i am pressing and how to diffrentiate?
  93. What is JSP
  94. What is the difference betweeen a statis and dynamic include?
  95. How can my JSP communicate with java class file
  96. I want to accomplish the following scenario: 1) user submits a jpg/gif file from an html form (using in the form, the user can browse to a file of their choice) 2) upload the jpg/gif file through a combination of Java and JSP’s 3) put the jpg/gif into a database on a server and/or into a folder on my local system.
  97. How to pop up a jsp page?refreshing every two seconds.
  98. What is difference between scriptlet and expression
  99. What does < %= obj.getXXX() %> the following expression get evaluated to ?
  100. How can we move from one JSP page to another(mean using what tecnique?)
  101. Top 100 JSP Questions Asked in Actual Interviews
  102. Can you make use of a ServletOutputStream object from within a JSP page?
  103. Can a JSP page instantiate a serialized bean?
  104. Is it possible to share an HttpSession between a JSP and EJB? What happens when I change a value in the HttpSession from inside an EJB?
  105. What is the page directive is used to prevent a JSP page from automatically creating a session?
  106. How do you prevent the Creation of a Session in a JSP Page and why?
  107. How do I include static files within a JSP page?
  108. How can I implement a thread-safe JSP page?
  109. How do I mix JSP and SSI #include?
  110. Can a JSP page process HTML FORM data?
  111. What JSP lifecycle methods can I override?
  112. How do I perform browser redirection from a JSP page?
  113. Is there a way to reference the “this” variable within a JSP page?
  114. Can I stop JSP execution while in the midst of processing a request?
  115. How do I use comments within a JSP page?
  116. How do I prevent the output of my JSP or Servlet pages from being cached by the browser?
  117. How does JSP handle run-time exceptions?
  118. How do I use a scriptlet to initialize a newly instantiated bean?
  119. How can I enable session tracking for JSP pages if the browser has disabled cookies?
  120. How can I declare methods within my JSP page?
  121. How can I set a cookie and delete a cookie from within a JSP page?
  122. Is there a way I can set the inactivity lease period on a per-session basis?
  123. How does a servlet communicate with a JSP page?
  124. How do I have the JSP-generated servlet subclass my own custom servlet class, instead of the default?
  125. How do you pass control from one JSP page to another?
  126. How do you restrict page errors display in the JSP page?
  127. How do you call stored procedures from JSP?
  128. How do you connect to the database from JSP?
  129. What is Declaration?
  130. What is difference between scriptlet and expression?
  131. What is jsp:use bean. What are the scope attributes & difference between these attributes?
  132. What are the implicit objects in JSP & differences between them?
  133. What are Custom tags. Why do you need Custom tags. How do you create Custom tag?
  134. What is the difference between include directive & jsp:include action?
  135. What are advantages of JSP?
  136. What is JSP?
  137. Can a single JSP page be considered as a J2EE application?
  138. How to call EJB from JSP.
  139. What is the architecture of JSP?
  140. What is the difference between servlet session and jsp session?
  141. Why should we setContentType() in servlet ?what is the use of that method?
  142. When jsp is compiled into servlet, where the servlet is actually stored(storage location)?
  143. How to generate BAR & PIE Graphs using JSP code…?
  144. What is the diff. b/n declaring members in and declaraing in jspinit() method ?
  145. How to check the value in the text field is not a number
  146. what is the use of extends in jsp…we we want to import a class in current jsp file which i am working how can i do that …if i use extnds for that means how can i do that…pls explain me this
  147. I have a String name & Map m, in my bean class. I have get & set methods on both. To Display the String name, i do The above one works fine. Te below one, displays the entire Map contents I know the KEY, how do i display the VALUE for that KEY
  148. What is the difference between , pagedirective include, action tag include ?
  149. What are the default objects provided by JSP container? Other than page, request, session and context objects.
  150. What is the default scope of jsp tags?
  151. When many Users are browsing the same application at the same time and they click the “Submit” button will many objects be created for each and every User?
  152. What is the difference between Difference between doGet() and doPost()?
  153. How do we perform redirect action without using response.sendRedirect(” “);
  154. A] Is the response.sendRedirect ends the existing session? B] If I logged in to a site ( say a.com) & then in same browser window I type the url for another site (say b.com), then does my session gets ended on first site ( a. com ) ?
  155. How to overwrite the init and destroy method in a jsp page.
  156. Where do we use hidden variables and url rewriting? and wat is the difference between them?
  157. What is the difference between session and cookie ?
  158. How to pass java script array to jsp page?
  159. What is the difference betweeen JSP forward and servlet forward methods?
  160. Where can we find the compiled file of jsp in the directory struture.
  161. How we abort jsp page from a servlet
  162. What is difference between getAttribute() and getParameter()?
  163. What is the diff. b/w PAGE,APPLICATION and SESSION implicit objects of JSP?
  164. Wat is the difference between and in jsp..wen translate into servlet..wer it is stored in servlet..can we create global variables in jsp..if yes then how??
  165. How can i restrict the user from Clicking of Back button in any browser
  166. In one class i stored the key and values in the hashmap.so using key value i have to check wheter the value for key is correct or not.so how to retreive the key and values in jsp page
  167. What is the differnce between application server and web server
  168. What is use of implict Objects?why the container is given those one?
  169. How to delete cookies in JSP?
  170. In Oracle table some fields are “null”.By default it will show as “null” in JSP page text box.But i dont want that. I want as blank textbox.What i can do for that?
  171. In Internet explorer if we give a jsp , How the server will know it has to execute?
  172. How the jsp changes will be effected in servlet file after converting?
  173. When to use struts technology? What type of applications are developed using struts frame work?
  174. What is the need of taglibraries?
  175. Explain online banking system using java.that means i need architecture of online banking system.please sir i want full details
  176. Text in textarea cant be copy by anyone while it is running in the browser (i.e,the text cant be copy and then paste on the other page) give me suggestion?
  177. How can i clear values in sessions. if i open a jsp page it is containing previous values. then i need to open a new page then only i am getting a fresh page
  178. What data is stored in the variable appname when we give the folowing statement String appname=(”manager”.equalsIgnoreCAse(request.getContextPath()))?”/manager”:”/portal”;
  179. Web browser concept using jsp
  180. Why we can’t implement interface in JSP? Why we can only extend classes in JSP?
  181. How can we implement logoutpage using jsp ..? and Is there any method to force the browser to show the same page again and again after logout..?
  182. How to Upload a textfile from JSP to Servlet
  183. My html form contains an INPUT “text” element that accepts Date, i want to catch that date and want to query it using JSP? In short, how can i use that HTML form element with Prepared Statements in JSP?
  184. Types of indexing used in oracle applications ? and when and how we decide to implement indexing to database ?
  185. What is the need of implicit objects?
  186. When we design some login form how we manage security for those forms?which technology used for that purpose?
  187. How Do you implement interface in JSP?
  188. How can initialize interface in JSP?
  189. How do u maintain a Session?
  190. What is the differences between JSP LifeCycle and Servlet LifeCycle?
  191. Can I call an interface in a JSP?
  192. What is the Difference between sendRedirect() and Forward?
  193. I want to place two buttons one for save and one for delete.i am using DispatchAction as controller,how can i find which button i am pressing and how to diffrentiate?
  194. What is JSP
  195. What is the difference betweeen a statis and dynamic include?
  196. How can my JSP communicate with java class file
  197. I want to accomplish the following scenario: 1) user submits a jpg/gif file from an html form (using in the form, the user can browse to a file of their choice) 2) upload the jpg/gif file through a combination of Java and JSP’s 3) put the jpg/gif into a database on a server and/or into a folder on my local system.
  198. How to pop up a jsp page?refreshing every two seconds.
  199. What is difference between scriptlet and expression
  200. What does < %= obj.getXXX() %> the following expression get evaluated to ?
  201. How can we move from one JSP page to another(mean using what tecnique?)