Practical Coding in Java

Learn to write and validate your own code

Darren Kessner, PhD

(revised January 9, 2026)

Previous: 0. Hello, world!

Hello

//
// Hello.java
//


//
// This is the traditional "Hello, world!" program in Java.
//
// The `Hello.java` file contains code that defines the `Hello` class.  The
// filename must match the class name.
//
// The Hello class defines a single function `main()`, which is the starting
// point for the program.
//
// The `main()` function has a single statement that prints "Hello, world!"
//
// For now you can ignore the other Java keywords: `public`, `static`,
// `void`, as well as the `String[] args`.
//


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

Output:

Hello, world!

Next: