J2EE Interview Questions – Part 2

Click on below link to see part 1 of the J2EE interview questions:

 J2EE Interview Questions

 

Here are the next set of J2EE interview questions & answers.

 

Difference between HTTPServlet and GenericServlet

 

GenericServlet is protocol independent.
HttpServlet extends GenericServlet and provides support HTTP protocol specific methods like goGet() and doPost().

 

Difference between Statement and PreparedStatement

 

PreparedStatements are precompiled, hence offer better performance.
For statement execution, a new execution plan is created every time, however PreparedStatements use the same execution plan.
PreparedStatements can prevent SQL injection attack as they use bind variables.

 

Difference between java.util.Date and java.sql.Date

 

Java.util.Date supports both the date and time components.
Java.sql.Date supports only the date component. So, an instance of this will have time set to zero.

 

Difference between DOM and SAX parser

 

A DOM parser creates a document structure in memory from the xml. Hence, its quick to access elements, but the issue is it gets slower for bigger files.
SAX parser does not create an internal structure. It takes the occurrence of components as event and tells the user as it when it reads the document. It is useful for parsing larger xml documents.

 

Difference between Web Server and Application Server

 

Application server exposes business logic and dynamic content to the client. Web server serves static content and delegates to servlets or application server for business logic or dynamic content.
Webserver supports HTTP protocol. Application server supports various protocols like HTTP, TCP/IP etc.
Application server provides additional functionalities like transaction management, resource pooling, messaging etc.

 

 

© 2015 – 2016, https:. All rights reserved. On republishing this post, you must provide link to original post

Leave a Reply.. code can be added in <code> </code> tags