File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes HttpServlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "HttpServlet" Watch "HttpServlet" New topic
Author

HttpServlet

saravanan ragunathan
Ranch Hand

Joined: Aug 02, 2010
Posts: 84

I checked API of HttpServlet...there is no abstract methods ...but why they declared it as
abstract class


"I Love Java Ranch"
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Because it isn't intended to be used without extending.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
saravanan ragunathan
Ranch Hand

Joined: Aug 02, 2010
Posts: 84
thanks Bear Bibeault for your kind reply

is there any reason to avoid the direct use of HttpServlet
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61437
    
  67

Because it doesn't do anything unless you extend it!

The base class simply returns HTTP "Bad Request" responses for all HTTP methods.
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1277

saravanan ragunathan wrote:
I checked API of HttpServlet...there is no abstract methods ...but why they declared it as
abstract class


Why we do so?can we make a class abstact without any method abstact in it..?Strange


No Kaustubh No Fun, Know Kaustubh Know Fun..
Nilesh Miskin
Ranch Hand

Joined: Jun 17, 2010
Posts: 44
Kaustubh G Sharma wrote:
Why we do so?can we make a class abstact without any method abstact in it..?Strange

Yes you can!
An abstract class is a class that is declared abstract. It may or may not contain abstract methods.


Nilesh Miskin
Kaustubh G Sharma
Ranch Hand

Joined: May 13, 2010
Posts: 1277

thanks
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: HttpServlet