Interfaces
In Java, you can use interfaces to provide a set of methods that classes must implement for them to be conformant.
Let's take the example of our Person class. We want to define a set of actions that define the behavior of any person, regardless of their age or gender.
A few examples of these actions include sleeping, breathing, and moving/walking. We can place all of these common actions in an interface and let any class that claims to be a person implement them. A class that implements this interface is often referred to as being of the type Person.
In Java, we use the keyword interface to denote that the following block will be an interface. All the methods in an interface are empty and are not implemented. This is because any class that will implement this interface will provide its unique implementation details. Therefore, an interface is essentially a group of methods with no bodies.
Let's create an interface to define the behavior of a person:
public interface PersonBehavior...