Then why it is abstract? Community Bot 1 1 1 silver badge. Stephen C Stephen C k 90 90 gold badges silver badges bronze badges. Here is the definition of an abstract class according to oracle's men: "An abstract class is a class that is declared abstract—it may or may not include abstract methods.
Sarvesh Kaushik Sarvesh Kaushik 1 2 2 bronze badges. Running into a solid wall of text is no less painful than running into a solid wall of brick. Ok, slightly less painful. And you don't actually answer the question. There are two reason for this. Let suppose it were not protected then we could create obj of this class which would we useless.
Second There are protected method in HttpServlet class. So to access protected thing of a class in order to have Servlet feature in your implementation class you must extend that class. So basically it is to force programmer to extend HttpServlet Class.
Devender Kumar Devender Kumar 1 1 gold badge 4 4 silver badges 12 12 bronze badges. Venu Palabandla Venu Palabandla 1 1 1 bronze badge. The Overflow Blog. Podcast Explaining the semiconductor shortage, and how it might end. Does ES6 make JavaScript frameworks obsolete? Featured on Meta.
Now live: A fully responsive profile. Linked 0. Related Hot Network Questions. However, nothing prevents you from obtaining a servlet API implementation from some third party and using that with the servlet container. In tomcat 4. Second, I'm not sure which spec you are referring to. The Java Lang Spec, P 8. However, the spec does not prevent a class with NO abstract methods from being declared abstract. There are other classes in Java like that for instance, look at the adapter classes like java.
Which access specifier is abstract? The access specifier for service is public void for the service method required by Servlet, and protected void for the overloaded version provided by HttpServlet.
The HttpServlet class is declared to be abstract, because you are expected to implement your own servlet class. HttpServlet is declared abstract to force you to implement your own servlet class, where you will presumably implement your own doPost or doGet method. HttpServlet defines NO abstract methods. However, the designers of Servlets did not want you to simply use HttpServlet as your servlet class. Notify me of new comments via email. Notify me of new posts via email.
Create a free website or blog at WordPress. Home About SatyamSoft. Share this: Twitter Facebook Email. Like this: Like Loading Leave a comment Posted by satyamsoft on January 31, in Servlet. In this version, this method always returns an empty enumeration and remains only to preserve binary compatibility. Dynamic ServletContext. Method parameters in javax. Constructors in javax. UnavailableException String, int instead.
UnavailableException Servlet servlet, String msg Deprecated.
0コメント