Java Tutorial

Learn Java from the ground up, from your first program to object-oriented programming, with examples and outputs on every page.

Java is a high-level, class-based, object-oriented programming language. It was designed so that programmers can write once, run anywhere (WORA): compiled Java code runs on any platform that has a Java Virtual Machine (JVM), without being recompiled.

This tutorial is for beginners and for students preparing for exams and interviews. Each lesson explains one concept, shows a complete program, and gives its output.

Your First Java Program

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

What You Will Learn

Prerequisites

You don't need any programming experience. Knowing basic computer use (files, folders, a text editor) is enough.

TipType every example yourself rather than copying it. You'll remember syntax much faster.
Track your progress through the Java course