Interfaces in Java

Learn what an interface is and how it works in Java.

Introduction

As previously discussed, Java does not allow multiple inheritance. Only single and multi-level inheritance is allowed. What if a class needs to inherit properties from two classes that aren’t related to each other?

Consider a fundamental real-life example. A baby inherits characteristics from both the father and mother, but the father and mother don’t hold a parent-child relationship. Many computing applications include the idea of multiple inheritance. ...