Mega Code Archive

 
Categories / Java Book / 001 Language Basics
 

0002 Compiling the Program

To compile the program, execute the compiler, javac, specifying the name of the source file on the command line: C:\>javac Example.java The javac compiler creates a file called Example.class. Example.class contains the bytecode version of the program. To run the program, use the Java interpreter, called java. Pass the class name Example as a command-line argument, as shown here: C:\>java Example When the program is run, the following output is displayed: Java. When Java source code is compiled, each individual class is put into its own file named classname.class.