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 began programming with Java back in the days of Java 1.4 and has been passionate about it ever since. You can connect with him on Facebook and watch his Java videos on YouTube.