Remarks
This program should be contained in a file HelloWorld.java, which may be placed in the classes/ subdirectory.
HttpServlet is the base class for servlets running in HTTP servers. Although servlets can be written for other kinds of server, in reality servlets are nearly always HttpServlets.
The doGet() method is called in response to an HTTP GET request directed at the servlet.
As the names suggest, the arguments describe the browser’s request and the servlet’s response.
Before writing to the output stream associated with the response, the content type header (at least) must be set.