What is an interface?
An interface is just like a
classand specifies the behavior that a class must implement.
An interface can be used to achieve 100% abstraction as it contains the method signatures/abstract methods(what to be done) and no implementation details (how to be done) of these methods. In this way, interfaces satisfy the definition of abstraction. The implementation techniques of the methods declared in an interface are totally up to to the classes implementing that interface.
An interface can be thought of as a contract that a class has to fulfill while implementing an interface. According to this contract, the class that
implements an interface has to
@Override all the abstract methods declared in that very interface.
An interface is declared just like a class but using the keyword