APIs & Libraries
Sanjeev Kumar
Senior Software Engineer @ Wipro Technologies | IBM Certified, AWS Cloud Practitioner
APIs :
API is the acronym {ak-ruh-nim} for Application Programming Interface. It enables two applications to communicate without having to know how other is implemented.
Libraries:
A library is a collection of useful techniques or functions. It refers to implementations that are designed to be reused during an application development.
APIs Vs Libraries :
The API is what a library looks like from the outside for a program that is using it. It is the "face" of a library to other programs. Libraries are the reusable implementations and APIs are interfaces to those implementations.
An Example: Java APIs and Libraries
The API of a Java library is the set of publicly accessible classes, interfaces, methods in the library. For instance, class System is a public class in Java's standard library, so it is part of the API of the standard Java library. we are using the API of the standard Java library if we are using class System.
A Java library is a collection of java classes which comes in those java packages (Swing, Input/Output etc.), usually but not necessarily located in a jar file. Input/Output libraries of JAVA SE are bundled within stdlib jar.