Java 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 : 106
Like every other website we use cookies. By using our site you acknowledge that you have read and understand our Cookie Policy, Privacy Policy, and our Terms of Service. Learn more Got it!