What's library and package?


I just wanted to organize my thought about relation between library and package so that I can be clear to use these functions.

What is library?

Library is group of programs and frameworks that is already tested which works for many problems.

Example of libraries?

There are a lot of kind of libraries. So I picked up some example:

  • Java standard libraries
  • Maven
  • Apache Commons


What is packages?

This group of programs which is called library are classified and stored as "packages" according to similar functions.

What's the example of packages?

Here's the example of packages in Java.

1) java.lang: Contains language support classes(e.g classed which defines primitive data types, math operations). This package is automatically imported.
2)  java.io: Contains classed for supporting input / output operations.
3)  java.util: Contains utility classes which implement data structures like Linked List, Dictionary and support ; for Date / Time operations.
4)  java.applet: Contains classes for creating Applets.
5)  java.awt: Contain classes for implementing the components for graphical user interfaces (like button , ;menus etc).
6)  java.net: Contain classes for supporting networking operations.


What's the difference?

Package is part of the library. I organized in the sheet.

You can find a lot of kinds of Libraries, packages, class, method in Java world.

Why library is created?

It's inefficient that every programmers spend times to create same things or solve same problems. So tested codes and frameworks are g to deal with many problems that programmers often face in a short time.

Related posts