> Package in java ~ Online tutorial

Package in java

Package
  • PROGRAMS are organized as sets of packages. Each has its own set of
    names for types, which helps to prevent name conflicts.
  • A top level type is accessible outside thepackagethat declares
    it only if the type is declared public.
  • The naming structure for packages is hierarchical . The members of a
    package are class and interface types , which are declared in compilation
    units of the package, and subpackages, which may contain compilation units and
    subpackages of their own.
  • A package can be stored in a file system or in a database .
  • Packages that are stored in a file system may have certain constraints on the organization of their compilation units to allow a simple implementation to find
    classes easily.
  • A package consists of a number of compilation units .
  • A compilation
    unit automatically has access to all types declared in its package and also automatically imports all of the public types declared in the
    predefined package
    java.lang.

  • For small programs and casual development, a package can be unnamed
    or have a simple name, but if code is to be widely distributed, unique
    package names should be chosen .
  • This can prevent the conflicts that would
    otherwise occur if two development groups happened to pick the same package
    name and these packages were later to be used in a single program.



buy java reference books




Please Give Us Your 1 Minute In Sharing This Post!
Please Give Us Your 1 Minute In Sharing This Post!
SOCIALIZE IT →
FOLLOW US →
SHARE IT →
Powered By: BloggerYard.Com

0 comments: