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

前端 未结 10 1697
面向向阳花
面向向阳花 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:46

    A quick rule of thumb just to start with: a library is a collection of java classes, usually but not necessarily located in a jar file, and all public methods of those classes form the API of that library.

    (the cleaner the code, the more you can rely on this rule ;) )

提交回复
热议问题