Bear Bibeault wrote:There is no "deviation from the rule".
What is being returned from the method is a PageContext instance.
Remember that it is possible to refer to an extended class by one of its ancestors. In this case, the method could return any class that extends JspContext. In this case, it's a PageContext.
but when we see the return type of getJspContext() it returns JspContext and if getJspContext() was to return pageContext instance,there would have been no need to cast the result of getJspContext() method to PageContext.
Then why do we cast it?