• Post Reply Bookmark Topic Watch Topic
  • New Topic

HttpServlet implementing Serializable

 
Bharath Chinnadurai Maharajan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When a class implements an interface, then all the Subclasses of it will inturn implement the inetrface implicitly. Then why is that the HttpServlet implements the Serializable interface when it is already being implemented by it super class GenericServlet.
(iam not sure this is a core java question or a servlet question)

--------------------------------
Bharath Chinnadurai Maharajan
SCJP 1.4
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think it implements it because it's superclass does.
Are you looking at source code to an implementation of HttpServlet?
 
Bharath Chinnadurai Maharajan
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ben,

I think it implements it because it's superclass does


Thats my arguement all about. If a super class implements an interface then all its subclass by agreement implement the interface implicitly. But even after the GenericServlet implementing the Serializable interface why its subclass HttpServlet have to implemnt the Serializable interface explicitly again. Is there any necessity for it to. If so what is it.

Are you looking at source code to an implementation of HttpServlet?


well iam not actually looking into its source though have have a plan to.

-----------------------------------
Bharath Chinnadurai Maharajan
SCJP 1.4
[ August 23, 2005: Message edited by: Bharath Chinnadurai Maharajan ]
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 15713
73
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats my arguement all about. If a super class implements an interface then all its subclass by agreement implement the interface implicitly. But even after the GenericServlet implementing the Serializable interface why its subclass HttpServlet have to implemnt the Serializable interface explicitly again. Is there any necessity for it to. If so what is it.

No, there isn't a necessity. Maybe it was done just to make it more clear that HttpServlet is also Serializable. You know, the API classes aren't 100% perfect, they were written by people too, so it's possible that there are some mistakes in there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!