Explain why HttpServlet is declared abstract ?
The Constructor HttpServlet() does nothing because this is an abstract class. Default implementations in a few Java classes like HttpServlet don?t really do anything. Hence, they need to be overridden.
Usually one of the following methods of HttpServlet must be overridden by a subclass:
Hi, 1)Suppose HttpServlet Class isn't declared as abstract,Still there is no use of creating the object of HttpServlet class because all the method present inside the HttpServlet mostly does nothing. 2)Declaring HttpServlet as abstract,provides a signal to the Developer that the class has no practical use, and don't create the object of this class. rather have your own implementation for your service. 3)you can override any method from doxxx or service() method for your Servlet,and you can have own business logic.not necessary to override all the methods of HttpServlet. any corrections are welcomed,let me know if i am wrong anywhere. Thanks Balu
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.