Can anyone please let me know the relation between a package and a sub package in java?
Subpackage in java Package inside the package is called the subpackage. It should be created to categorize the package further. Let's take an example, Sun Microsystem has definded a package named java that contains many classes like System, String, Reader, Writer, Socket etc.
The package java has subpackages awt , applet , io , lang , net , and util , but no compilation units. The package java. awt has a subpackage named image , as well as a number of compilation units containing declarations of class and interface types.
The package present inside a package is called the subpackage. It is created to further categorize packages. For example, If we create a package inside the techvidvan package then that will be called subpackage. Let's say we have created another package inside techvidvan and the name of subpackage is tutorials.
Packages can be nested to contain subpackages, and that can be done to an arbitrary depth.
There is no relation between packages and subpackages. It is just a hierarchical structure for the convenience of a developer and has no further meaning to Java itself.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With