Hi Friso,
Answer D (None of the above) is correct.
As you know any jsp page is finally converted into a
Servlet which is then compiled, compiled class is instantiated , loaded into memory to service users requests.
There are basically 3 important jsp lifecycle methods. Their exact signature are
1. public void jspInit() { }
2. public void _jspService(HttpServletRequest req, HttpServletResponse res) throws ServletException , IOException { }
3. public void jspDestroy()
Note that only _jspService has the underscore in front of it but not the others. Basically the jsp's converted
java class file implements 'HttpJspPage' interface which extends from 'JspPage' , which inturn extends from 'Servlet' interface. So essentially the auto generated java class of the jsp file implements all 3 interfaces.
Generally the jsp vendors provide a vendor specific Base class which implements 'HttpJspPage' interface. It has concrete implemtations for public void jspInit() and public void jspDestroy(), and the 3rd method _jspService(req,res)'s implemented dynamically at the time the jsp page is converted to a java file.
Since _jspService(req, res) is automatically 'added' by the jsp engine, we can't even try to override , because in Java there can't be 2 methods of same signature rigth?
But we CAN override the other 2 lifecycle methods jspInit() and jspDestroy(). But again in Java we can't make the access modifier more restrictive when we override. Meaning we can't override a 'public' access level method with a method of 'package' level. This is the reason why the other answers are incorrect. They do not have the important 'public' access modifier.
Regards,
Maha Anna