All servlets must implement the Servlet interface of package?

  1. java.servlet

  2. javax.servlet

  3. .servlet

  4. All are same


Correct Option: B
Explanation:

To solve this question, the user needs to know about the Java Servlets API and its interface.

The correct answer is:

B. javax.servlet

Explanation:

All the servlets must implement the Servlet interface of the javax.servlet package. The javax.servlet package contains a number of interfaces and classes that define the contracts between a servlet class and the runtime environment provided for an instance of such a class by a conforming servlet container. The javax.servlet package provides the base classes for defining HTTP servlets. Thus option B is correct.

Option A is incorrect because there is no package named java.servlet.

Option C is incorrect because the option is incomplete and doesn't provide the package name.

Option D is incorrect because there is only one correct option, and that is option B.

Therefore, the answer is: B. javax.servlet

Find more quizzes: