Advertisement

Package

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.

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

Advertisement

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.

Advertisement

Share this Term

  • Facebook
  • LinkedIn
  • Twitter

Survey: Why Is There Still a Gender Gap in Tech?

Do you work in the tech industry? Help us learn more about why the gender gap still exists in tech by taking this quick survey! Survey respondents will also be entered to win a $100 Amazon Gift Card!

Related Reading

Tags

DevelopmentJavaProgramming Languages

Trending Articles

Newest Articles

Go back to top