The API refers to the application programming interface that the rest of the world sees and can use.
The method can be part of the public interface or not. But the API is really a set of methods.
The most common API-related phenomenon in java will be an interface, which is really a public method declaration.
Another useful way to look at the API is to accept it as a contract. As an example, consider List . It tells you the signatures of the methods that you can use in the list, and in javadoc you see what the contract is (what you can expect and what you need for the list to behave as expected)
source share