Intro to Java
Lesson 1 / 18
Pito
What is Java? Your first program
The language of Android, banks and Minecraft
Chapter 1. Basics
10 minutes
Video
3 questions
Java is one of the most widely used languages in the world. Its motto: "Write once, run anywhere". Java code runs inside the JVM (Java Virtual Machine), so it behaves the same on Windows, Mac and Linux.
It powers 📱 Android apps, 🏦 banking systems, 🎮 Minecraft (Java Edition) and big company servers.
public class Main {
public static void main(String[] args) {
System.out.println("Hello, world!");
}
}
// Output: Hello, world!
It looks wordy, but the template is always the same:
- class Main — every Java program lives inside a class
- main — the program starts here
- System.out.println(...) prints one line
Variables
String name = "Jasur";
int age = 15;
double score = 4.5;
boolean active = true;
System.out.println(name + " is " + age);
// Output: Jasur is 15
💡 The file name must match the class name:
Main→Main.java.
📚 Free resources
- dev.java — Learn — official lessons from the makers of Java (Oracle)
- University of Helsinki — Java Programming MOOC — free, from zero, with auto-checked exercises
- Exercism — Java — free exercises with mentor feedback