on up back w3c Fifth International World Wide Web Conference

First Java Program

// HelloWorld.java
// First Java program, to get experience with using the Java tools
class HelloWorld
{
    public static void main (String args[])
    {
        System.out.println("Hello, World!");
    }
}

To compile this program, enter the command:javac HelloWorld.java

This will produce the binary bytecode file HelloWorld.class as output.

To execute this program, enter the command:java HelloWorld

Hello, World! should appear on your terminal.


Java - An Introductory Language Tutorial (E.A.Johnson)