An interface is a collection of abstract methods. A class implements an interface, thereby inheriting the abstract methods of the interface.
In Java, an interface is a blueprint of a class that contains only abstract methods (methods without a body) and constant fields. An interface is used to define a common behavior for multiple classes, allowing them to work together. Interfaces provide a way to achieve abstraction in Java and are used to define a contract that must be implemented by concrete classes. By implementing an interface, a class agrees to perform the behavior specified in the interface. Interfaces can also be extended by other interfaces, making it possible to define a hierarchy of behaviors.
First read the answer fully, then try to explain it in your own words. After that, open a few related questions and compare the concepts. This method helps you remember the topic for a longer time and improves exam preparation.