The following simple program prints the String ``Hello, world'' and stops:
class Hello {
public static void main(String[] args) {
System.out.println(``Hello, World'');
}
}
Before the program can be executed, it must be compiled into a form suitable for machine execution called a class file Hello.class. The name of the class file generated for a class C is simply C.class.
In the Rice OwlNet computing environment, the program must be stored in a file ending the extension .java. It is common practice to name the file containing a program after the root class of the program. According to this convention, the ``Hello, world'' program would be stored in a file Hello.java. On Owlnet, the command
javac Hello.javawill compile all of the classes in the file Hello.java, generating a separate class file for each class.
The ``Hello, world'' program is executed by telling a Java Virtual Machine to execute the corresponding class file. On Owlent, the command
java Hellowill execute the program with the root class Hello.class.