Java package: Difference between revisions
Appearance
Content deleted Content added
No edit summary |
Cleaned up (ahem re-written) following comments in the cleanup page |
||
Line 1: | Line 1: | ||
Related [[Datatype|types]] in Java are placed in a common package. |
|||
{{cleanup-date|December 2005}} |
|||
*A package provides a unique [[namespace|namespace]] for the types it contains. |
|||
Packages are collections of classes and interfaces in Java. Each package is a simply a folder created by programmer. |
|||
*A package facilitates access protection. |
|||
Ther are basically two types of packages in Java: |
|||
*A package can contain the following kinds of [[Datatypes|types]]. |
|||
**[[Class (computer science)|Classes]] |
|||
**[[interface (computer science)|Interfaces]] |
|||
**Enumerated Types |
|||
**Annotations |
|||
A package is represented in Java code by a series of textual names delimited by the '.' (dot) character. |
|||
e.g |
|||
import java.awt.event.*; |
|||
And is stored on disk {or in a compressed file such as a [[Jar (file format)|jar]] or Ear (Enterprise Archive)} |
|||
as a series of nested directories. |
|||
e.g. |
|||
/java/awt/event |
|||
# User Defined packages |
|||
# API Packages or Inbuild packages |
|||
'''User''' defined packages are the packages where programmer can crate it it base / super classes. [[By importing]] these packages programmer can develop new classes by inheriting attributes and behaviours of these classes. |
|||
{{compu-lang-stub}} |
{{compu-lang-stub}} |
Revision as of 18:00, 5 January 2006
Related types in Java are placed in a common package.
- A package provides a unique namespace for the types it contains.
- A package facilitates access protection.
- A package can contain the following kinds of types.
- Classes
- Interfaces
- Enumerated Types
- Annotations
A package is represented in Java code by a series of textual names delimited by the '.' (dot) character. e.g import java.awt.event.*;
And is stored on disk {or in a compressed file such as a jar or Ear (Enterprise Archive)} as a series of nested directories. e.g. /java/awt/event