This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes why most classes and interface in servlet package abstract ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "why most classes and interface in servlet package abstract ?" Watch "why most classes and interface in servlet package abstract ?" New topic
Author

why most classes and interface in servlet package abstract ?

moneer mohammed
Ranch Hand

Joined: Feb 18, 2005
Posts: 66
Please can any one tell me why most classes and interface in servlet package abstract


java_just
Jose Esteban
Ranch Hand

Joined: Nov 28, 2004
Posts: 102
It is obvious that interfaces must be abstract.

Apart from that, only GenericServlet and HttpServlet classes are abstract (if I am not wrong), so they must be subclassed to create an (HTTP)servlet.

For example, to write a generic servlet, you need only override the abstract service method, because the rest of the methods are already implemented in the GenericServlet class.
Bassam Zahid
Ranch Hand

Joined: Mar 09, 2005
Posts: 61
Interfaces are "rules" so they must be present in specifications implemented by third parties as is the case with servlets and JSP.

Abstract classes let you create your own classes "extending" the abstract functionality. Moreover, they ease the developer by providing dummy method implementations.


BS<br />SCJP 1.4 88%<br />SCWCD 1.4 86%
 
GeeCON Prague 2014
 
subject: why most classes and interface in servlet package abstract ?