Packages in Java
Package is a way to group related class and interface under one unit. It is used to resolve name conflicts between class and names. They provides access control over their source code. The import statement must be at the beginning of a file before any class or interface definitions. Use of an import statement makes class or interface available for use by classes and interfaces defined in that file.
The java.lang package is automatically imported by the runtime system. Dates and Calendar Classes are used to manipulate dates and times in the program. They are the part of java dot util package. For manipulating dates and times, java dot util package is required to import in the program. Use of packages shows that classes and interfaces in package are related. They provide easy way to locate the classes which are defined under the same packages. Names of classes and interfaces won't be in conflict with those of other programmers. Using packages the access of classes can be restricted. To import specific class or interface into current file, one should use import statement. The import statement must be at beginning of file before any class or interface definitions & makes class or interface available for use by classes and interfaces defined in that file