by Dinesh Thakur Category: Packages

Access modifiers define the scope of the class and its members (data and methods). For example, private members are accessible within the same class members (methods). Java provides many levels of security that provides the visibility of members (variables and methods) within the classes, subclasses, and packages.

 
by Dinesh Thakur Category: Packages

The packages are used for categorization of the same type of classes and interface in a single unit. There is no core or in-built classes that belong to unnamed default package. To use any classes or interface in other class, we need to use it with their fully qualified type name. But some time, we've the need to use all or not all the classes or interface of a package then it's a tedious job to use in such a way discussed. Java supports imports statement to bring entire package, or certain classes into visibility. It provides flexibility to the programmer to save a lot of time just by importing the classes in his/her program, instead of rewriting them.

 
by Dinesh Thakur Category: Packages
  1. The programmer can easily find them, by knowing their position with their set of task. The common types of classes and interfaces are placed in the same package.
  2. The type name (class or interface) must not conflict with other package type name, because at the same time if both packages are in use, compiler must not confuse.
  3. There must not be any restriction to access any type from another type within the same package. But assign the restricted access from types outside the package.
 
by Dinesh Thakur Category: Packages
 
by Dinesh Thakur Category: Packages
 
by Dinesh Thakur Category: Packages
 


About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.