Java, Programming, Object Oriented Design, Objectorientedprogramming, Oop.
dog.sleep(); // Output: Buddy is sleeping. } } In this example, Animal is an interface with two abstract methods: makeSound and sleep. The Dog class implements the Animal interface and provides concrete implementations for both methods. When to Use Interfaces Multiple Inheritance: When a class