Is java violating OOPS concept?

According to OOPS concept the subclass will get all the properties of base class...

But in case of servlets, HttpServlet is the subclass of GenericServlet and Generic servlet can be used for all protocols where as HttpServlet is used only for Http. In this case is java violating OOPS concept? What r ur suggetions friends?

[336 byte] By [AnishAbrahama] at [2007-11-27 2:08:00]
# 1

> According to OOPS concept the subclass will get all

> the properties of base class...

> But in case of servlets, HttpServlet is the subclass

> of GenericServlet and Generic servlet can be used for

> all protocols where as HttpServlet is used only for

> Http. In this case is java violating OOPS concept?

> What r ur suggetions friends?

Generic servlet can't be used for any protocol. It's abstract. Where do you find a specification of GenericServlet in the docs that is not covered by HttpServlet as well?

CeciNEstPasUnProgrammeura at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 2
Actually i read in a tutorial about the difference between GenericServlet and HttpServlet.In that it was like GenericServlet can be used for any protocols where as HttpServlet can use for Http. Can u plz explain what all are the differences between both?
AnishAbrahama at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 3

> Actually i read in a tutorial about the difference

> between GenericServlet and HttpServlet.

> In that it was like GenericServlet can be used for

> any protocols where as HttpServlet can use for Http.

GenericServlet can't be used for anything. It's abstract. Believe me, I read it in the API docs.

> Can u plz explain what all are the differences

> between both?

HttpServlet is a http-specific implementation of GenericServlet. Everything an instance referred to by a reference of type GenericServlet can do can also be done by HttpServlet.

CeciNEstPasUnProgrammeura at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 4
Another doubt is that HttpServlet is an abstract class but dont have even a single abstract method inside that. Then why it is an abstract class?
AnishAbrahama at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 5

> Another doubt is that HttpServlet is an abstract

> class but dont have even a single abstract method

> inside that. Then why it is an abstract class?

Because either it's a pure design decision, or it doesn't implement certain abstract methods it inherits and is forcibly abstract. Maybe both.

CeciNEstPasUnProgrammeura at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 6
So ur saying like if we can override some specific methods of GenericServlet in HttpServlet, then we can use HttpServlet for any protocols rt?
AnishAbrahama at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 7

> So ur saying like if we can override some specific

> methods of GenericServlet in HttpServlet, then we can

> use HttpServlet for any protocols rt?

From the API docs:

Defines a generic, protocol-independent servlet.

Protocol-independent. Not "all protocols", but "no protocol".

CeciNEstPasUnProgrammeura at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...
# 8
that was a good reply... thanks dude....:)
AnishAbrahama at 2007-7-12 1:56:51 > top of Java-index,Java Essentials,Java Programming...