Reputation: 6691
What is exact difference between an API(Application Programming Interface) and a Package?
Upvotes: 1
Views: 6335
Reputation: 20820
An API is a specification of your application/library. For example this is the Java 6 API.
A package is a logical grouping of the classes, modules, and functionalities of your application into name spaces. Generally packages are distributed via jar files (a jar will be a collection of packages). For instance this is a java 6 package.
Upvotes: 2
Reputation: 3271
I suspect you're getting confused because of something like this. This is the API and contains 0 code. It describes how the packages should be laid out, but they really are different.
A package is how your organize and group your classes together. For example java.awt.datatransfer.Clipboard has a package of java.awt.datatransfer.
An API is just a specification. It describes how something should work.
Hope that helps.
Upvotes: 2