Java Packages is the collection of pre-defined classes interfaces and thus all these classes contains both the implemented and non-implemented methods. Java is using java.lang package as the default package. Below are the list of some of the packages in java.

java.lang package

java.util package

java.io package

java.math package

java.rmi package

java.sql package

A java package is the collection of similar types. After Writing all the required pre-defined classes in java, those are being categorized in different categories and hence are termed as packages. For ex-

java.lang packages contains all the basic operations which are required for writing a simple java application and hence is the default package for any java class. Like that ,

java.io packages contains all the required classes and functionality for doing input and output operations using file and console.

As the java vendors has categorized the different classes in different packages, the same we can do while developing our own java application, which makes us to say that packages can be used to search and locate the classes and interfaces. Best practice is to always keep the classes in a packages which must be followed by three dots naming convention.

For ex-  com.def.core ---> A package name , followed with three dots.

Note: Package must always be the first statement of any java class and can be only one package statement in each java file.

package is the keyword used before declaring any package name in the java source file.
For ex-    package  com.def.core.* ;

In the above statement .* indicate we are supposed to use all the classes defined in the com.def.core package.








Related Posts:

  • Cloning in java Cloning is a concept used to create a new object of the existing object. It means creating another object in the memory same as the existing one by copying the content of it. For cloning a object java vendor has provided… Read More
  • Deep Cloning in java It is the manually implemented coding for doing cloning. This concept has came to overcome the limitation found with shallow cloning which fails to clone the data member. Through deep cloning we can be able to cover up the … Read More
  • Shallow Cloning in java It is a default cloning in java implemented by the Java vendor simply by using one predefined method in the Object class i.e clone().  Using shallow cloning we can only be able to clone the member of the class but fa… Read More
  • Dynamic Dispatch in Java It is a concept in java to achieve the Dynamic / Run-time polymorphism. It is the process of assigning sub-class object in super type reference later if needed that sub-class object can be type-caste into its super type. Dy… Read More
  • String in Java String is a reference data type and hence string literals are treated as object and get stored in the string constant pool. We must have to define any string within double-quote otherwise it will give compilation error. Str… Read More

0 comments:

Post a Comment

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

201978

Online Members

Live Traffic