To answer this question, you need to understand the concepts of servlets in Java.
Option A) GenericServlet - This option is correct. GenericServlet
is an abstract class that provides a generic implementation of the Servlet
interface. It can handle any type of protocol and is protocol-independent.
Option B) HttpServlet - This option is correct. HttpServlet
is a subclass of GenericServlet
and provides specific implementation for handling HTTP requests. It is specifically designed for handling HTTP protocol requests and responses.
Option C) Both (A) and (B) - This option is correct. Both GenericServlet
and HttpServlet
are types of servlets. HttpServlet
is a subclass of GenericServlet
, so it inherits all the methods and functionality of GenericServlet
.
Option D) None of the Above - This option is incorrect, as both GenericServlet
and HttpServlet
are types of servlets.
The correct answer is C) Both (A) and (B). This option is correct because both GenericServlet
and HttpServlet
are types of servlets in Java.