What is the correct sequence of steps for handling a client in a Java servlet…

2024

What is the correct sequence of steps for handling a client in a Java servlet as per the lifecycle of a servlet?

  1. A.

    Init method, Service method, doPost/doGet method

  2. B.

    Init method, doPost/doGet method, Service method

  3. C.

    Service method, doPost/doGet method, Destroy method

  4. D.

    Init method, Service method, Destroy method

  5. E.

    Question not attempted

Attempted by 53 students.

Show answer & explanation

Correct answer: D

The standard servlet lifecycle is initialization, request servicing, and destruction. Therefore the sequence is init method, service method, and destroy method.

Explore the full course: Up Lt Grade Assistant Teacher 2025