Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • 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
Saloon Keeper
Posts: 4032
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...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic