Skip to content
Advertisement

Can a normal Class implement multiple interfaces?

I know that multiple inheritances between Interfaces is possible, e.g.:

JavaScript

But is it possible to have a regular Class inherit from multiple Interfaces like this:

JavaScript

Advertisement

Answer

A Java class can only extend one parent class. Multiple inheritance (extends) is not allowed. Interfaces are not classes, however, and a class can implement more than one interface.

The parent interfaces are declared in a comma-separated list, after the implements keyword.

In conclusion, yes, it is possible to do:

JavaScript
Advertisement