Safekipedia

Java (programming language)

Adapted from Wikipedia · Discoverer experience

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

Java is a high-level, general-purpose programming language that helps programmers write code once and use it anywhere. This means that once you create a Java program, it can run on any computer that has Java installed, without needing to be changed. Java code is first turned into something called bytecode, which can run on special programs called Java virtual machines, no matter what kind of computer it is.

Java became very popular after it was first released in May 1995. It was created by James Gosling at Sun Microsystems and has been one of the most used programming languages for many years. Although it is still widely used, some newer languages have started to become more popular.

Today, Java continues to be an important tool for developers around the world. The current version as of March 2026 is Java 26, with several older versions still supported for different uses.

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 created four different versions of Java for various uses. These versions are:

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

Sun also 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 designed to work on many different types of computers and operating systems. This is done by turning Java code into a special kind of code called JVM bytecode. Instead of working directly with 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, either as 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, which 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, like forgetting to clean up memory or trying to use memory that has already been cleaned up.

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 mostly like C++ and C, but it was made mainly to focus on objects. All code in Java is written inside special containers called classes, and 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 or let classes share many features in some ways, 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 that could be added to web pages shown in web browsers. However, this way of doing things stopped being used when Java version 9 came out in 2017.

Servlet

Main article: Java servlet

Java servlet helps web developers add new features to web servers and connect to other systems. 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 gets turned into 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, like a box for storing items, you had to decide exactly what kind of things it would hold, and if you wanted a box for different things, you had to make a new box each time. Generics let programmers make one box 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 better in a few ways. They have talked about how it handles certain types of numbers and how fast it works. There have also been times when the main way Java runs programs had small safety issues. Also, some parts of Java that help connect to databases can be a bit complicated to use. Because of this, developers sometimes use other tools that make these tasks easier.

Class libraries

Main article: Java Class Library

The Java Class Library is a collection 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, handling many tasks at once, organizing data, and more.
  • Libraries that help programs talk to databases, find information on networks, and manage other programs.
  • Libraries for creating windows and buttons on a computer screen, including tools for playing sounds.
  • 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 that start with /** and end with */, which are different from normal comments that start with /* or //. This helps developers keep track of how their code works.

Implementations

See also: Free Java implementations and List of Java compilers

Oracle Corporation owns the main version of Java, after buying 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, which 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

The Java programming language needs a special software platform to run programs. Oracle provides the Java platform for this purpose. Another option is the Android SDK, mainly used for creating Android applications.

Java plays an important role in Android, an open source mobile operating system. While Android is mostly written in C and uses the Linux kernel, the Android SDK uses Java for its applications. However, it does not follow the usual Java rules for design. Instead, it uses its own special way to run programs, made for devices like smartphones and tablet computers.

There was a disagreement between Oracle and Google about using Java in Android. Different courts had different opinions over time, but in the end, 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.