Interfaces
Interfaces in Java are the mechanisms used to provide and declare a contract that defines how to interact with and reuse an existing software. The main idea behind this approach is that it removes the requirement of knowing how things are done internally; you only need to know what the required input parameters should be and what to expect by calling an interface. Exactly what the internal workings of the code are and how the processing is done are not really important, and as long as you adhere to the declared contract, everything should be ok.
Another major benefit of this "design by contract" approach is that it reduces the impact of code and process updates on external users. For example, if you call an add
interface on a class called calculator
that takes two numbers and returns the result, you (as a consumer of this service) do not need to know or care how the addition is done—internally, the class could be simply adding the two Java integers together,...