Package

Why Trust Techopedia

What Does Package Mean?

In the context of Java, a package is an organized and functionality based set of related interfaces and classes. Packages organize classes that belong to the same category or provide similar functionality. Classes facilitate class downloads in groups and may be stored in compressed files, like Java Archive (JAR) files.

Advertisements

Package names should be unique, and a package class may access package access members for other package classes.

Techopedia Explains Package

Java packages are similar to labeled computer folders. For example, most users prefer keeping HTML pages, images, and scripts in different folders for better organization. Likewise, there are many classes and interfaces in the Java language. Programmers prefer organizing related classes and interfaces in different directories. Thus, a particular package contains interrelated classes and interfaces.

Generally, a Java package may contain classes, interfaces, Java annotations and enumerated types. To define a class package, the package keyword is used in the source file for that class and is usually the first keyword in the source file. For example, if a class named Foo belongs to a package named com.mypackage, the following line should exist at the beginning of the Foo Java source file: package com.mypackage.

Advertisements

Related Terms

Margaret Rouse
Technology Specialist
Margaret Rouse
Technology Specialist

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles in the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret’s idea of ​​a fun day is to help IT and business professionals to learn to speak each other’s highly specialized languages.