What is the difference between a Java API and a library?

前端 未结 10 1542
面向向阳花
面向向阳花 2021-01-31 21:10

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

10条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-31 21:52

    Straight from Wikipedia:

    In computer science, an application programming interface (API) is an interface that defines the ways by which an application program may request services from libraries

    Java contains many libraries in those packages (Swing, etc.), and the API is the interface by which we request services (perform actions, etc.).

提交回复
热议问题