Because, the creators of the servlet framework cannot give all the functionality that you might want in your application.
So, if they make their class abstract, you the developer will be providing all the functionality you need and still stick to the framework standards defined by them.
Any class which has one or more abstract methods is called an abstract class. But in the normal class we can't have any abstract methods. We cannot create an object for the abstract classes. When we inherit the abstract class we should implement the abstract method which we inherit.
A Concrete class
an abstract class is nothing but class which contains both abstract and concrete methods for abstract class we r nt create object Syntax for pure abstract class is abstract class x { public void abstract y(); public void abstract z(); public void abc() { }
A logical abstract base class for a class called CricketPlayer could be Batsman class or Bowlerclass.
A constructor of a class in invoked when a object of that class is created. As an abstract class can't have an object, so we can't create a constructor of the abstract class. But we can create a constructor of a concrete subclass of that abstract class and we have to pass the object of that concrete subclass to the abstract class.
In order to dispose of a session that is no longer needed, you can call the invalidate() method of the HttpServlet class. Assuming you have an instance of HttpServlet called 'session' you would do this: session.invalidate();
HttpServlet and GenericServlet
GenericServlet defines a generic, protocol-independent servlet whereas HttpServlet Provides an abstract class to be subclassed to create an HTTP servlet suitable for a Web site that uses the Http Protocol.
Any class which has one or more abstract methods is called an abstract class. But in the normal class we can't have any abstract methods. We cannot create an object for the abstract classes. When we inherit the abstract class we should implement the abstract method which we inherit.
A Concrete class
The servlet class created in web applications usually extend the javax.servlet.HttpServlet class. The HttpServlet extends the javax.servlet.GenericServlet. These classes contain the basic features that are required to run a web application.
an abstract class is nothing but class which contains both abstract and concrete methods for abstract class we r nt create object Syntax for pure abstract class is abstract class x { public void abstract y(); public void abstract z(); public void abc() { }
A logical abstract base class for a class called CricketPlayer could be Batsman class or Bowlerclass.
A constructor of a class in invoked when a object of that class is created. As an abstract class can't have an object, so we can't create a constructor of the abstract class. But we can create a constructor of a concrete subclass of that abstract class and we have to pass the object of that concrete subclass to the abstract class.
An abstract class cannot have a constructor and hence you cannot invoke the constructor of the class - i.e., you can instantiate an abstract class and hence you cannot call the constructor of an abstract class.
False. In fact, it is possible to have no abstract methods in an abstract class.
The classes which have one or more abstract methods are abstract. To declare a class as abstract, use the abstract keyword in front of the class keyword, before the class declaration. Abstract classes cannot be instantiated. Similarly the new keyword cannot be used to create an object of the abstract class. Remember that the constructors and static variables cannot be declared as abstract. Any subclass of an abstract class must either implement all of the abstract methods in the superclass or be itself declared abstract.