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 ...

Get Extending Jenkins now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.