Android apps
Android was built around Java. Many apps are still written in Java, and Kotlin, Google's preferred language, runs on the same tools.
Examples: Older Android apps, banking and shopping apps
Free Lesson
Java is a general-purpose, object-oriented programming language first released in 1995. Its code compiles to bytecode that runs on any device with a Java Virtual Machine (JVM), which is why Java's motto is “write once, run anywhere.”
James Gosling and his team created Java at Sun Microsystems, and Oracle has owned it since buying Sun in 2010. It powers Android apps, Minecraft: Java Edition and many bank and airline back ends. Follow a program through the JVM below.
Interactive demo
Follow one Hello World program through its four stops. Pick a step, then choose a device for the last one.
You write source code
A .java file is plain text that people can read. The computer cannot run it yet.
Step through the classic first program. Each line gets a plain-English note.
Hello.java
public class Hello {public static void main(String[] args) {System.out.println("Hello, World!");}}
Line 1 of 5
Every Java program lives inside a class. The class name, Hello, must match the file name, Hello.java.
Since Java 25, beginners can also skip the class and write a shorter version in a single file:
void main() {
IO.println("Hello, World!");
}Six questions on what Java is and how it runs.
Real world
Android was built around Java. Many apps are still written in Java, and Kotlin, Google's preferred language, runs on the same tools.
Examples: Older Android apps, banking and shopping apps
Minecraft: Java Edition is written in Java, and its huge modding scene writes mods in Java too.
Examples: Minecraft: Java Edition, mods
Banks, airlines and stores run large server systems in Java because it is fast, stable and well supported.
Examples: Payment, booking and inventory systems
Popular data and developer tools run on the JVM and are written in Java.
Examples: Apache Kafka, Hadoop, IntelliJ IDEA
Common mix-up
Java and JavaScript are different languages. Netscape renamed its browser language to JavaScript in 1995 to ride Java's popularity, and the confusion stuck. Here is how the three most-taught languages compare.
| Java | JavaScript | Python | |
|---|---|---|---|
| Main job | Android apps, big business back ends, games like Minecraft | Interactive web pages, plus servers with Node.js | Data, AI, automation and scripts |
| Runs on | The JVM, on almost any device | Every web browser, and Node.js | The Python interpreter |
| Types | Static: declare types like int and String | Dynamic: a variable can hold anything | Dynamic, with optional type hints |
| Compiled? | Yes, to bytecode with javac | No, run as is (engines compile on the fly) | No, run as is |
| Speed | Fast once the JVM warms up | Fast in modern browsers | Slower, but fast enough for most scripts |
| Hello World | 5 lines with a class and main | console.log("Hello, World!"); | print("Hello, World!") |
| Beginner feel | More rules up front, clear errors early | Easy start in any browser | Easiest to read and write |
Jargon buster
They fit inside each other like nesting boxes: the JDK contains the JRE, and the JRE contains the JVM.
Runs bytecode on one kind of device. It is the engine.
The JVM plus the standard library a program needs to run. Enough to run Java apps, not to build them.
The JRE plus tools for programmers, like the javac compiler. Install a JDK to learn Java.
Get started
It takes a little longer to start, then it pays off. Java asks you to declare types and put code in classes, so Hello World is five lines instead of one. Those rules catch mistakes before your program runs, and the same ideas carry over to C#, Kotlin and C++. Many schools teach Java first, including AP Computer Science A.
Install a free OpenJDK build such as Eclipse Temurin, write Hello.java and run it with java Hello.java.
Learn int, double, String and boolean, then if and else. Build a grade calculator that prints a letter grade.
Use for and while loops, arrays and your own methods. Build a number guessing game.
Write a class with fields and methods, then make objects from it. Build a small to-do list or bank account program.
Code Card turns your Claude Code, Codex, and OpenClaw sessions into a public developer profile with activity graphs, streaks, badges, and a shareable card, so you can track your coding progress. Start with npx code-card.
FAQ
Java is a programming language for building apps, games and servers. You write code once, a compiler turns it into bytecode, and the Java Virtual Machine runs that bytecode on Windows, Mac, Linux and more without changes.
Java is used for Android apps, large business and banking back ends, games like Minecraft: Java Edition, big data tools like Apache Kafka, and developer tools like IntelliJ IDEA.
No. Java and JavaScript are different languages with different rules and uses. JavaScript runs web pages in the browser, while Java runs on the JVM for apps and servers. They only share part of a name.
Java has more rules than Python or JavaScript, such as declaring types and putting code in classes, so the first week is slower. Those rules catch mistakes early, and many schools teach Java first, including the AP Computer Science A course.
Yes. The Java language is free to learn and use, and free open-source builds of the JDK, such as OpenJDK and Eclipse Temurin, run on Windows, Mac and Linux. Oracle's own JDK has its own license terms for business use.