Share This Topic -

Java inbuilt packages:

Package : Packages are java`s way of grouping a verity of classes and/or interfaces together.

Java API packages :  java API provides a large number of classes grouped into different packages according to functionality.

Frequently used API packages are as under.

Syntax for import packages is as under

import packagename.classname;


import packagename.*;

These are known as import statements and must appear at the top of the file, before any file declaration as you can see in our few examples.

Here import is a keyword.

The first statement allows the specified class in the specified package to be imported.

EX :

import java.awt.Color;

double y =  java.lang.Math.sqrt(x);

Here lang is a package, Math is a class and sqrt is a method.

For create new package you can write...

package firstPackage;

public class Firstclass



             body of class