Multiple interfaces in Java

(Last Updated On: March 5, 2019)

Learn about Multiple interfaces in java with code example i.e. how to write more that one interfaces and how a class can implement them.

Multiple interface implementation is easy. We’ll learn it by a code example. but, we should be familiar with following concept.

 

Now, lets understand multiple interface in java by example.

In below program example, there are two interfaces Flyable and Eatable. Flyable interface contains a method fly() and Eatable interface contains a method eat(). Both the methods are unimplemented.

There is a class called “Bird”, that will implement both interfaces with syntax given below .

Then, the bird class will override and implement methods fly and eat from both interfaces. See below, the complete code example, how the bird class is implementing multiple interface in java.

 

Example of multiple interfaces Implementation in Java

 

Output:
Bird eats
Bird flying