• Post Reply Bookmark Topic Watch Topic
  • New Topic

Qn on HttpServlet

 
Chandrakanth
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
why is it HttpServlet is abstract, as i was not able to find any abstract method in HttpServlet.
 
Scott Selikoff
author
Bartender
Posts: 4033
18
Eclipse IDE Flex Google Web Toolkit
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Generally speaking, all servlets have functions and when you inherit from this class you are creating a servlet that has a particular function.

This class is abstract in order to discourage developers from ever instantiating it since this would be tantamount to having a servlet that does nothing. Could it have been marked without the abstract so that it could be invoked? Sure, but it wouldn't do anything. Abstract is a nice way of forcing developers to do things the right (or intended way)... or a scary way of finding lengths people will go to avoid doing it the right way...
 
What are you doing? You are supposed to be reading this tiny ad!
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!