Polyglot
Languages Java
Volume Java

Java

A general-purpose, statically typed, object-oriented programming language compiled to bytecode and executed on the Java Virtual Machine. The mainstream language of enterprise application development since the late 1990s.

Paradigms
imperative · OOP
Typing
static
Memory
gc
Version
23
First released
1995

Java is a general-purpose, statically typed, object-oriented programming language compiled to a portable bytecode that executes on the Java Virtual Machine (JVM). The combination of a fixed bytecode format, a tracing garbage collector, and the principle of write once, run anywhere established Java as the dominant language for cross-platform enterprise software through the late 1990s and 2000s. The language is intentionally conservative in its core syntax — extensions have been incremental and have favoured readability over expressiveness — though the JVM ecosystem has accommodated substantial language innovation through alternative front ends, notably Scala, Kotlin, Clojure, and Groovy.

History

Java was developed by James Gosling and a team at Sun Microsystems beginning in 1991 under the project name Oak, initially intended for embedded consumer electronics. The language was renamed Java and released publicly in 1995, alongside the first version of the JVM and the early specifications of the standard library. Sun Microsystems released the platform as open source under the GPL in 2006; Oracle acquired Sun in 2010 and continues to lead the language’s stewardship. Major revisions have been incremental: Java 5 (2004) introduced generics, autoboxing, and the enhanced for loop; Java 7 (2011) introduced the try-with-resources statement; Java 8 (2014) introduced lambda expressions and the streams API; Java 9 (2017) introduced the module system, Project Jigsaw; Java 14 introduced records (preview); Java 17 (2021) was a long-term-support release that consolidated several preview features; Java 21 (2023) introduced virtual threads (Project Loom) and pattern matching for switch. The current release is Java 23, with Java 25 designated as the next long-term-support release.

Hello world

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

Compilation and execution with the standard toolchain:

javac Hello.java       # produces Hello.class
java  Hello            # executes the class file on the JVM

Java 21 introduced unnamed classes and instance main methods as a preview, permitting a substantially shorter form for introductory programs:

void main() {
    System.out.println("Hello, world!");
}

The mainstream build systems are Maven and Gradle, both of which manage dependencies declared against repositories such as Maven Central. The reference JVM implementation is OpenJDK; commercial distributions include Oracle JDK, Amazon Corretto, Azul Zulu, and Eclipse Temurin.