Object Oriented Programming

Java Package

Package in java is used to:

  • prevent name-space collision.
  • visibility and access security.
  • enhance the maintainability of classes and interfaces.

Packages in java can be classified into:

  1. built-in packages
  2. user-defined packages

Access package resources

We can access resources like class, abstract class, interface from another package in the following ways:

  • using fully qualified name
  • using import statement as import package.*
  • using import statement as import package.class

Please Share this page
Views : 43