Interfaces in Java
Learn what an interface is and how it works in Java.
We'll cover the following...
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. For this, Java provides another building block: an interface.
What is an interface?
An interface is a completely abstract class that is used to group related methods with empty bodies. Unlike an abstract ...