Java syntax: Difference between revisions

Content deleted Content added
No edit summary
Tags: Mobile edit Mobile web edit
Tags: Mobile edit Mobile web edit
Line 323:
===Packages===
Packages are a part of a class name and they are used to group and/or distinguish named entities from other ones. Another purpose of packages is to govern code access together with access modifiers. For example, <code>java.io.InputStream</code> is a fully qualified class name for the class <code>InputStream</code> which is located in the package <code>java.io</code>.
 
A package is essentially a [[namespace]]. Packages do not have hierarchies, even though the periods may suggest so. A package can be controlled whether it is accessible externally or internally of a project using [[Java Platform Module System|modules]].
 
A package is declared at the start of the file with the <code>package</code> declaration: