In Java, the package keyword is used to specify a directory structure to which the current source file must belong. For example:

package com.mycompany.code;

public class MyClass {
}

In the above example, the source file MyClass.java must be placed under the directory /com/mycompany/code

Here are some rules regarding the package statement:

 

Related keyword: import. See all keywords in Java.

 

Related Topics:

 

Other Recommended Tutorials:


About the Author:

is certified Java programmer (SCJP and SCWCD). He started programming with Java in the time of Java 1.4 and has been falling in love with Java since then. Make friend with him on Facebook and watch his Java videos you YouTube.