Compiling & Running

Hello World example

HelloWorld.java (Filename must match class' name)

public class HelloWorld {

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

}

Compiling

javac HelloWorld.java

Executing

java HelloWorld

Last updated