Java - Package

What is a package?
A package is a kind of directory that contains a group of related classes and interfaces. Packages hides its class and interfaces in a separate directory. Java has many such packages it its library. If you want to use a classes, you  have to import it into your program. If you want to use a method, then you have to import the corresponding class or interface.
A group of package is called library. Any class and interface inside a package is reusable.When a package is imported, its sub-packages are not automatically imported into a program. A separate import statement should be written to for every package or sub-package.

Java library
      |
Packages
      |
Classless and interfaces
      |
methods

There are two different types of packages.
1. build-in
2. User defined 
Build -in Packages
Build -in packages are already available in Java. These packages provide all necessary classes, interfaces and methods to perform tasks. Some important packages are:
java.lang:   This package has primary classes and interfaces for developing a basic Java program.
java.util: It has many useful collections. Date, time operations, victors... 
java.awt: awt stands for Abstract Window Toolkit.This package is useful for developing GUI-color, paintings, images etc. It consists one important sub-package java.awt.event. It provides actions like select radio button, menu etc.
javax.swing: Helpful for GUI. It is an extended package of java,awt(package developed from another package by adding new features). 'x' represents it as an extended package.
java.net: Useful for authentication for network, creating sockets, to establish communication between client-server.
java.applet: Related to Java applets.
java.text: It contains two important classes. 'DateFormat' is to format date and time. 'NumberFormat' is to format numeric values.
java.sql: Helps to connects to the database like oracle, retrieve and use data in Java program.

User-Defined Package: 
Package created by user. User defined package can be used exactly same way as the build-in package. 
The keyword to create a package is package.

Features related to the Object Oriented Programming Systems(OOPS)

The root  concept of the object oriented programming(OOP) is 'Object' and developing programs using class and object. OOP languages allow programmers to use and reuse the same modules multiple times.You yourself are an 'object'. Tell me about yourself,(properties) - name - yoyo, age- 28.What can you do(methods) eating-eat(), running - run()
In JAVA  there is a main task to perform(Main method). That one task is divided into many modules(classes). Each class can perform certain task. Many methods are written inside a class to perform actions with data(variable). So variables and methods are also called 'members' of the class.

Some features of OOP are
Class/object:
Access Specifiers:
An access specifier is a key word that specifies how to access the member of classes or a class itself. There are four access specifiers in Java:
Private:  'Private' members of a class are not accessible anywhere outside the class. They are accessible only within the class by the methods of that class.
Public: Public member of a class are accessible from everywhere.
Protected: Accessible outside the class but only within the same directory.
Default: If not specified by a programmer, it is 'default' . Default members are accessible outside the class, bur within the same directory.Private for instance variable. Public for  methods, class.
Constructors: 
Encapsulations:
Abstractions
Inheritances
Polymorphism