Safekipedia

Java (programming language)

Adapted from Wikipedia · Adventurer experience

James Gosling, a computer scientist, speaking at a technology seminar in 2008.

Java is a high-level, general-purpose programming language. It lets programmers write code once and use it everywhere. When you make a Java program, it can run on any computer with Java installed, without changes.

Java became very popular after it was first released in May 1995. It was created by James Gosling at Sun Microsystems. Java has been one of the most used programming languages for many years. Today, Java is still important for developers all over the world. The current version as of March 2026 is Java 26. Some older versions are still used for different jobs.

History

See also: Java (software platform) § History

James Gosling, Mike Sheridan, and Patrick Naughton started the Java language project in June 1991. Java was first made for interactive television, but it was too advanced for that at the time. The language was named Oak after a tree near Gosling's office, then Green, and finally Java, after Java coffee from Indonesia. Java was designed to look like C and C++, which many programmers already knew.

Sun Microsystems released the first public version, Java 1.0, in 1996. It could run on many different computers without needing to be changed, which was called "write once, run anywhere" (WORA). It was safe and could control what programs could do on the internet or with files. Soon, web browsers could run small Java programs called Java applets on web pages, and Java became very popular. Later versions, like Java 2, had different versions for different kinds of computers. In 2006, Sun made much of Java free for everyone to use.

Sun tried to make Java an official standard, but later decided not to. Instead, they let people help improve Java through the Java Community Process. In 2006, Sun made most of Java's core code free and open for everyone. After Oracle Corporation bought Sun in 2009–10, they took care of Java. In 2016, Oracle said that new versions of Java would no longer work in web browsers.

Java can run on many devices, from laptops to very big computers used for science.

Oracle and others advise people to uninstall old versions of Java because they may have security problems.

Principles

There were five main goals when creating Java:

  1. It must be simple, object-oriented, and familiar.
  2. It must be robust and secure.
  3. It must work on any type of computer.
  4. It must run quickly.
  5. It must be interpreted, threaded, and dynamic.
James Gosling, the creator of Java, in 2008

Versions

Main article: Java version history

As of September 2025[update], Java 8, 11, 17, 21, and 25 are supported long-term versions.

Oracle stopped free updates for the old Java 8 version in January 2019 for business use, but still offers updates for personal use. Other companies like Adoptium also provide free versions of Java with extra fixes.

Major release versions of Java, along with their release dates:

VersionDate
JDK Beta1995
JDK 1.0January 23, 1996
JDK 1.1February 19, 1997
J2SE 1.2December 8, 1998
J2SE 1.3May 8, 2000
J2SE 1.4February 6, 2002
J2SE 5.0September 30, 2004
Java SE 6December 11, 2006
Java SE 7July 28, 2011
Java SE 8 (LTS)March 18, 2014
Java SE 9September 21, 2017
Java SE 10March 20, 2018
Java SE 11 (LTS)September 25, 2018
Java SE 12March 19, 2019
Java SE 13September 17, 2019
Java SE 14March 17, 2020
Java SE 15September 15, 2020
Java SE 16March 16, 2021
Java SE 17 (LTS)September 14, 2021
Java SE 18March 22, 2022
Java SE 19September 20, 2022
Java SE 20March 21, 2023
Java SE 21 (LTS)September 19, 2023
Java SE 22March 19, 2024
Java SE 23September 17, 2024
Java SE 24March 18, 2025
Java SE 25 (LTS)September 16, 2025
Java SE 26March 17, 2026

Editions

See also: Free Java implementations § Class library

Sun made four different versions of Java for different uses. These versions are:

Java’s tools are grouped into packages, each with related parts that work together.

Sun once had a version called Personal Java, but it is now replaced by newer Java ME versions.

Execution system

Java JVM and bytecode

Main articles: Java (software platform) and Java virtual machine

Java is made to work on many different computers and operating systems. It does this by turning Java code into a special kind of code called JVM bytecode. Instead of using the computer's own instructions, Java uses a virtual machine (VM) to run this bytecode. Most people use a Java Runtime Environment (JRE) to run Java programs. These programs can be standalone applications or small programs that run in web browsers.

Because Java uses this universal bytecode, moving programs from one computer system to another is easier. However, running bytecode can make programs slower than programs written directly for a specific computer. To help with this, Java uses something called just-in-time (JIT) compilation. This turns bytecode into the computer's own instructions while the program is running. This makes Java programs faster.

Non-JVM

Some special computers have hardware that can run JVM bytecode directly, without needing a separate virtual machine. For example, some ARM-based processors used to have a feature called Jazelle to run Java bytecode in hardware, though this is not common anymore.

Automatic memory management

Java has a special system that automatically cleans up memory. When a part of a program (called an object) is no longer needed, Java’s garbage collector finds and frees up the memory it used. This helps prevent problems that can happen when programmers have to manage memory themselves.

Java also does not let programmers change where objects are stored in memory, which helps keep programs safe. While this system takes care of memory, programmers still need to manage other resources, like connections to websites or files, carefully.

Syntax

Main article: Java syntax

Java's way of writing code is similar to C++ and C, but it focuses on objects. All code in Java is written inside special containers called classes. Most things are objects, except for simple pieces of data like numbers and yes/no values, which are kept simple for speed.

Java does not let you change how math signs work, but it does let special rules called interfaces share features. Java uses comments—like short notes for people reading the code—in three ways: one for a single line, one for many lines, and one special kind for making easy-to-read guides about the code. Some tools can read these notes to help people understand the code better.

This dependency graph of the Java Core classes was created with jdeps and Gephi.

Hello world

Here’s a simple example of a program that prints “Hello World!” using the regular Java style:

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

In Java 25, there is a simpler way to write small programs:

void main() {
    IO.println("Hello World!");
}

Special classes

Applet

Main article: Java applet

Java applets were small programs added to web pages. This way of doing things stopped when Java version 9 came out in 2017.

Servlet

Main article: Java servlet

Java servlet helps web developers add new features to web servers. Servlets are pieces of Java code that run on the server and create responses, like web pages, for people asking for information. They often create HTML pages when someone uses HTTP, but they can do other things too.

JavaServer Pages

Main article: JavaServer Pages

JavaServer Pages (JSP) are tools that let developers mix Java code with web page designs. When a web page with JSP is asked for, it becomes a special kind of Java program called a servlet, which then creates the web page to send back.

Swing application

Main article: Swing (Java)

Swing is a set of tools for making windows and buttons in Java programs. It can make these look like they belong on different kinds of computers, such as Windows or macOS, by changing its appearance.

JavaFX application

Main article: JavaFX

JavaFX is a collection of tools for building programs that can run on many different devices, like computers and web browsers. It can make programs with nice graphics and is meant to be used instead of Swing for newer Java programs. JavaFX works on Microsoft Windows, Linux, and macOS, but it does not change to look exactly like each operating system.

Generics

Main article: Generics in Java

In 2004, Java got a feature called generics. Before this, when you made a container to hold things, you had to decide exactly what kind of things it would hold. Generics let programmers make one container that can check at the start what kind of things go in it, which helps avoid mistakes later.

Criticism

Main article: Criticism of Java

Some people think Java could be improved in a few areas. They have talked about how it works with certain numbers and its speed. There have also been a few small safety issues with how Java runs programs. Some parts that help connect to databases can be a little hard to use. Because of this, developers sometimes choose other tools to help with these tasks.

Class libraries

Main article: Java Class Library

The Java Class Library is a set of tools that help people write programs in Java. It was made by Oracle and others working together through the Java Community Process. This library has many useful features, such as:

  • Core libraries for reading and writing files, connecting to the internet, and doing many tasks at once.
  • Libraries that help programs talk to databases and find information on networks.
  • Libraries for creating windows and buttons on a computer screen.
  • A special part that runs Java programs.
  • Ways to share Java programs on the internet.

Documentation

Main article: Javadoc

Javadoc is a tool made by Sun Microsystems to help people write clear instructions for their computer code. It uses special comments in the code to explain how things work.

Implementations

See also: Free Java implementations and List of Java compilers

Oracle Corporation owns the main version of Java. They bought Sun Microsystems in 2010. Oracle offers Java for Windows, macOS, Linux, and Solaris.

Oracle provides two versions: the Java Runtime Environment (JRE) for users to run Java programs, and the Java Development Kit (JDK) for developers. The JDK includes tools like the Java compiler.

Another version called OpenJDK is also available and free to use. Java is designed so that programs work the same on different computers.

Use outside the Java platform

Java needs a special software platform to run programs. Oracle provides the Java platform for this. Another option is the Android SDK, used for making Android applications.

Java is important for Android, an open source mobile operating system. Android is mostly written in C and uses the Linux kernel, but the Android SDK uses Java for its apps. It uses its own special way to run programs, made for smartphones and tablet computers.

There was a disagreement between Oracle and Google about using Java in Android. Courts had different opinions, but it was decided that Google's use was allowed.

Related articles

This article is a child-friendly adaptation of the Wikipedia article on Java (programming language), available under CC BY-SA 4.0.

Images from Wikimedia Commons. Tap any image to view credits and license.