Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Relation between package and a sub package in Java

Tags:

java

Can anyone please let me know the relation between a package and a sub package in java?

like image 852
user1006819 Avatar asked Oct 21 '11 09:10

user1006819


People also ask

What is 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.

Can a package have sub packages in Java?

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.

What is package and Subpackage?

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.

Can packages have sub packages?

Packages can be nested to contain subpackages, and that can be done to an arbitrary depth.


1 Answers

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.

like image 61
Mark Rotteveel Avatar answered Nov 15 '22 01:11

Mark Rotteveel