Multiple choice technology programming languages

What is the likely effect of calling a servlet with the POST HTTP method if that servlet does not have a doPost() method?

  1. If the servlet has a doGet() method, it executes that instead.

  2. 404 response code: SC_NOT_FOUND.

  3. 405 response code: SC_METHOD_NOT_ALLOWED.

  4. 500 response code: SC_INTERNAL_SERVER_ERROR.

  5. 501 response code: SC_NOT_IMPLEMENTED.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

If a servlet receives an HTTP POST request but does not implement the doPost() method, the default implementation in HttpServlet returns an HTTP 405 (Method Not Allowed) response code, indicating that the requested HTTP method is not supported by this resource.