Servlet do not have a main method. They are under the control of another java application called container. When the web server gets a request for a servlet then server hands the request not to servlet directly but to the container where the servlet is deployed.
Container has the overall role in servlet’s life. It creates the request response objects, create or allocate thread for the servlet, calls the service() method etc.
The container finds the correct servlet based on the URL in the request, and creates or allocates a thread for the request and calls the service() method, passing the request and response objects as arguments. The service() method process the request and the response goes back to the client through container. The service() method completes, so the thread dies or returns to the container managed thread pool.