vtshadow
vtshadow

Reputation: 125

Extending a class that already implements an Interface

If I had a class:

public class Foo implements Serializable{
...
}

and I have a class

public class Hoo extends Foo{
...
}

Does that mean that Hoo is also Serializable?

Thanks!

Upvotes: 1

Views: 82

Answers (1)

Khaelex
Khaelex

Reputation: 762

Expansion of comment by @ajb:

From JLS 8.1.5

An interface type I is a superinterface of class type C if any of the following is true:

  • I is a direct superinterface of C.

  • C has some direct superinterface J for which I is a superinterface, using the definition of "superinterface of an interface" given in §9.1.3.

  • I is a superinterface of the direct superclass of C.

The third bullet addresses your question.

Upvotes: 5

Related Questions