Say “Hello, World!”
Write and run a basic Java program with console output.
We'll cover the following...
Welcome to Java! In this course, you’ll learn the fundamentals of Java programming in a hands-on, practical way. We’ll start by writing your first Java program, printing a message to the screen, and breaking down how Java is structured. No prior experience? No problem—just bring curiosity and your keyboard.
Goal
You’ll aim to:
Write and run a basic Java program.
Use
System.out.println()to display output.Understand Java’s basic structure.
Your first Java program
Let’s print the first Java program:
That’s it—you’ve written a full Java program that prints a message to the screen!
What’s going on?
public class Maindefines the class namedMain. It’s the program’s entry point.main()is the method where every Java program starts running.System.out.println()displays output in the console.Each statement ends with a semicolon
;.