Java Interview Questions - Servlets

Here are the most popular Java interview questions about Servlets.

See all questions

How many servlet instances are created when multiple requests arrive simultaneously?


Only one Servlet instance is created at the time of the first call in the program. This instance is reused for all further requests even if multiple requests arrive simultaneously.

Describe the two different types of Servlets.


The two types of Servlets are GenericServlet and HttpServlet.

GenericServlet is a protocol-independent Servlet used as a base class for writing non-HTTP servlets. It provides basic functionality for writing a Servlet.

HttpServlet is an extension of GenericServlet that is used for writing Web-based HTTP servlets. It is used for HTTP methods like

...

Looking for developers?