Interfaces define a standardized set of commands that a class will obey.
The commands are a set of methods that a class implements.
The interface definition states the names of the methods and their return types and argument signatures. There is no executable body for any method that is left to each class that implements the interface.
Once a class implements an interface, the Java compiler knows that an instance of the class will contain the specified set of methods. Therefore, it will allow you to call those methods for an object referenced by a variable whose type is the interface.
Implementing an interface enables a class to be "plugged in" to any situation that requires a specific behavior (manifested through the set of methods).
An analogy: a serial interface on a computer defines a set of pin/wire assignments and the control signals that will be used. Note that:
Using an interface rather than inheritance to specify a certain set of methods allows a class to inherit from some other class.
Interfaces can also specify constants that are