This question already has an answer here:
- Library vs. framework vs API? [closed] 8 answers
I am trying to understand what exactly an API is.
From my current understanding, an API (Application Programming Interface) is a contract provided by a software instance, that guarantees a defined set of behaviors, which are triggered by a defined set of actions.
An API is a "public" sort of construct, as it defines the rules of communication with the outside world.
Similarly, a Java Interface in a nutshell, is also a construct, that a given Java Class (which implements that interface) has to provide, e.g. provide the functionality defined in that Interface (by writing the function implementations).
Both seems to be doing virtually the same thing, defining a set of behaviors that will be triggered if the right action (e.g. call, or format of the call) is taken.
So is it correct to refer to Interfaces provided by Java (e.g. Collections) or even ones written by me, as APIs?