Out of curiosity I was looking at the HttpServlet class's code and found that its parent class "GenericServlet" defines the method "getServletName()" declared in the interface "ServletConfig". However the GenericServlet's getServletName() method makes a call to "sc.getServletName()" if the ServletConfig's object "sc" is not null. I could not understand how this thing works since it seems to be calling itself when I do a ctrl+click in eclipse to see the implementation of the method! There is no overridden implementation in the HttpServlet class too!
Here is a snapshot of the GenericServlet's implementation :
public String getServletName() {
ServletConfig sc = getServletConfig();
if (sc == null) {
throw new IllegalStateException(
lStrings.getString("err.servlet_config_not_initialized"));
}
return sc.getServletName();
}
Can anybody enlighten me on this..