Java Reference
In-Depth Information
application, create a group of nested packages conforming to the following directory
structure:
/org/juneau
Any source files that are placed within a package must contain the package state-
ment as the first line in the source. The package statement lists the name of the pack-
age in which the source file is contained. For instance, suppose that the main class for
the widget application is named JuneauWidgets.java . To place this class into a
package named org.juneau , physically move the source file into a directory named
juneau , which resides within the org directory, which in turn resides within the root
of the source folder for the application. The directory structure should look like the fol-
lowing:
/org/juneau/JuneauWidgets.java
The source for JuneauWidgets.java is as follows:
package org.juneau;
/**
* The main class for the Juneau Widgets application.
* @author juneau
*/
public class JuneauWidgets {
public static void main(String[] args){
System.out println("Welcome to my app!");
}
}
The first line in the source contains the package statement, which lists the name
of the package that the source file is located within. The entire package path is listed in
the statement, and the names in the path are separated by dots.
Note A package statement must be the first statement listed within the Java
source. However, there may be a comment or Javadoc comment written before the
package statement.
Search WWH ::




Custom Search