1) HttpServlet doesn't have any Abstract methods but we can say that HttpServlet is an Abstract Class,How?
2) Could you tell me is there any classes of this type in both J2SE and J2EE?
Printable View
1) HttpServlet doesn't have any Abstract methods but we can say that HttpServlet is an Abstract Class,How?
2) Could you tell me is there any classes of this type in both J2SE and J2EE?
Hi chandra,
we can declare a class as abstract even though if it contains all concrete methods(with implementaitons). like
public abstract class Test{
}
or
public abstract class Test{
public void m1(){}
}
Similarly HttpServelt is also has all implemented methods but they do nothing(like in out eg:).
If it is non-abstract when it is instatiate it, it is like do nothing servlet.
That is the reason why it had make abstract so that the actual functionality is implemented in child class which is extending that HttpServlet class.
Thanks & Regards,
--Suresh--
one more example of abstract class without any abstract method(s),other than HttpServlet existed in J2SE i.e.
[B]public abstract class Component[/B] as java.awt.Component;
[COLOR="Red"]No method of Component class is abstract [/COLOR]:)