Java Interview Question

Use this basic question and answer to prepare for your next Java interview.

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 GET, POST, etc.

Looking for developers?