Can an interface extend the Serializable interface?

Viewed 20151

Is it possible to create an interface extending the Serializable interface?

If yes, will that extended interface behave like the Serilizable interface? If not, why?

4 Answers

Yes, you can extend the Serializable interface. If you do, all classes that implement the new subinterface will also be implementing Serializable.

So can we do that?

Yes

will that extended interface will take the same effect as the Serilizable interface?

Yes

Yes, it's normal. I did it once when decided that all classes in my domain should be serializable. They implemented some interface already so I simply extended that interface from Serializable (as you describe).

Related