Hi! My first guess: in that way, you can write a Servlet WITHOUT write ALL the abstract methods. The concrete methods of HTTPServlet implements the DEFAULT and EXPECTED behavior.
Angel "Java" Lopez @ajlopez On Sun, Jan 11, 2015 at 4:52 AM, <sreya...@gmail.com> wrote: > I have been browsing the source code of Tomcat and would like to know why > the javax.servlet.HTTPServlet class has a non abstract implementation of > the doGet, doPost, etc methods. Why not just declare them abstract ? I mean > HTTPServlet is an abstract class so why take the trouble to write > implementations in HTTPServlet ? Isn’t it better to just mark them as > abstract methods ? > > > The default methods obviously do nothing until they are overridden, > wouldn't it be cleaner code if they were abstract ? > > > > > > > Regards > Sreyan Chakravarty