Sunday, 12 April 2015

Q. If the super class implements serializable,then no need that the sub classes would also be implementing serializable interface,then why does HttpServlet class implements Serializable interface when the superclass that it extends, GenericServlet, has already implemented Serializable interface?

Ans: It is not compulsary that if the super class implements serialiable interface then sub class should also implement the same,it is a best practice to declare in the subclass that it also implements the same interface. This way if some one just reads the subclass he will have the complete picture.

No comments:

Post a Comment