What is Java?
What is Java?
Java is a general-purpose, object-oriented programming language. James Gosling's team at Sun Microsystems released it in 1995. Today Oracle and the open-source OpenJDK community keep it growing, with a new version every 6 months.
Why developers love it
- Write once, run anywhere – your code compiles to bytecode, which runs on any device that has a JVM (Windows, Mac, Linux, servers).
- Strongly typed – the compiler catches many mistakes before your app runs.
- Automatic memory management – the garbage collector frees memory you no longer use.
- Huge ecosystem – Android apps, banking systems, Minecraft, big-data tools and backend servers.
JDK vs JRE vs JVM
| Part | What it does |
|---|---|
| JVM (Java Virtual Machine) | Runs bytecode |
| JRE (Runtime Environment) | JVM + the standard libraries needed to run apps |
| JDK (Development Kit) | JRE + tools to build apps (javac compiler, debugger) |
💡 You only need to install the JDK. Since Java 11 there is no separate JRE download.
How Java code runs
- You write
Hello.java(source code). javaccompiles it intoHello.class(bytecode).- The JVM loads the bytecode and runs it. Its JIT compiler turns frequently used code into fast machine code while the app runs.
Example
# Compile, then run
javac Hello.java
java Hello
# Java 11+: run a single file directly
java Hello.java