SE450: Packages: Compiling with Packages [5/47] Previous pageContentsNext page

To compile the code, place it in the file types\simplePackage\Main.java and run the compiler:

> javac types\simplePackage\Main.java

The compiler produces the file types\simplePackage\Main.class. To execute the static types.simplePackage.Main.main() method, run the interpreter:

> java types.simplePackage.Main

Note that the compiler, rather irritatingly, does not complain if the directory name and package name disagree; however, the JVM does.

Previous pageContentsNext page