Hello World Application in Java
David Matuszek

Here is everybody's favorite program in Java:


public class Hello {
  public static void main (String args[]) {
    System.out.println ("Hello, World!");
  }
}

To run this program,

  1. Copy this program exactly as written onto a file named Hello.java. Do not give the file some other name.
  2. Compile the file by putting it in the same directory as the compiler and issuing the command
        javac Hello.java
    This should create a file named Hello.class
  3. Run the file by issuing the command
        java Hello
    This should print "Hello, World!"

Notes