Curriculum / Java / Lesson 01

Introduction to Java

Java was released by Sun Microsystems in 1995 with the promise "write once, run anywhere." Java code compiles to bytecode, which runs on the Java Virtual Machine (JVM) — so the same compiled program runs unchanged on Windows, macOS, or Linux.Java is widely used for Android apps, enterprise backend systems, and large-scale software where reliability matters..

1 of 11
beginner 📖 4 min read 🎯 1 question

Introduction

Java was released by Sun Microsystems in 1995 with the promise "write once, run anywhere." Java code compiles to bytecode, which runs on the Java Virtual Machine (JVM) — so the same compiled program runs unchanged on Windows, macOS, or Linux.

Java is widely used for Android apps, enterprise backend systems, and large-scale software where reliability matters.

💡 Key insight Java is compiled AND interpreted: your source compiles to bytecode, and the JVM interprets (or JIT-compiles) that bytecode at runtime.

Syntax

syntax
public class ClassName {
    public static void main(String[] args) {
        // your code here
    }
}

Example

Every Java program's entry point is public static void main(String[] args) inside a class whose name matches the filename.

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

Try it yourself

Copy this example into the Java compiler and run it — try changing a value and see what happens.

Quick Quiz

1. What must a Java file be named if it contains 'public class Main'?

Back to curriculum