Site icon TestingDocs.com

Java Sub-packages

Overview

Let’s learn about Java subpackages in this tutorial. A package is a collection of related classes, interfaces, and sub-packages. The package inside the package is called a subpackage.

Java Subpackages

Packages in Java allow the programmer to organize related classes, interfaces, and sub-packages in Java projects. On the computer filesystem packages are the folders or directories that contain the classes, interfaces, etc. Sub-packages are like subfolders created inside another folder. We can create a sub-package in a package to categorize the package further.

Example

In this example, the top-level java is a package and the packages inside the package java are called sub-packages. Example sub-packages are awt, io, net, …, util.

The following awt, io, net,…, util packages are called sub-packages w.r.t to java because they reside inside the java package.

 

Java Tutorials

Java Tutorial on this website:

https://www.testingdocs.com/java-tutorial/

For more information on Java, visit the official website :

https://www.oracle.com/java/

Exit mobile version