OK, maybe this should be in basic Java or something, but I was wondering about it... You have to override at least one of the doX methods, right? But none of them is abstract, so how can it tell? I thought the definition of an abstract class was a class with at least one abstract method, which had to be overridden in order to implement the class. Can anyone put me right? Thanks
Joined: Nov 06, 2000
They do not have to be abstract in order to be able to override them. An abstract is not required to have an abstract method, it's just that any class with an abstract method will have to be declared as abstract.
Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Joined: Jun 14, 2002
An abstract class is a class that cannot be instantiated, only extended. HttpServlet is declared abstract, because there is no sense in using it directly - its methods provide default functionality only (which, in most cases, does nothing). You can add your own functionality by overriding any of those methods in a class that extends HttpServlet.
Joined: Mar 22, 2002
I thought the definition of an abstract class was a class with at least one abstract method, which had to be overridden in order to implement the class.
No, putting the modifier "abstract" is sufficient to make a class abstract. An abstract class can have some or all its methods implemented, but it cannot be instantiated.