I know that an API is called a set of functions used to call something, and a library is a collection of classes, but what is actually API in package like java.lang
API, Library, and Framework are related-so-confusing terms.
API: Abstraction of Library, offers abstract view of a library which will suggest what are in the library and how can we access them to make use of. It may also provide the classification and description about the functionality and relationship of the components implemented in the library.
Library: Set of actually implemented and ready to use components
Framework: It may be a part of library or some times may use more than one library to offer a particular category of services.
Source: My understanding after reading some books and net sources.