Java

Hand-drawn row of five identical terracotta hexagons, each on a patch of different hatching in sand, umber and moss.

Java is a programming language that Sun Microsystems designed so compiled programs could run on different kinds of computers with software that supports Java on each system. Its designers modeled Java’s syntax, the rules for writing code, on C++ and included checks for possible errors (Gosling & McGilton, 1996a; Gosling & McGilton, 1996b). One design dispute concerns checked exceptions, which require developers to account for certain failures in their code and can make published interfaces harder to change (Oracle, 2025d; Venners & Eckel, 2003).

From Oak to Java

Java began as a language for consumer electronics. Patrick Naughton, Mike Sheridan and James Gosling began Sun’s Green project in December 1990. The language project began in June 1991. Gosling designed Java’s predecessor, Oak, for software built into consumer devices. The team later revised and renamed Oak when it turned to the Internet (Computer History Museum, 2001; Computer History Museum, n.d.; Gosling et al., 1996).

Announcement and first release Contested: studies disagree on this

Accounts differ on when the public could first try Java. Sun’s standardization paper dates the first public alpha, an early test release, to March 27, 1995. Early team member Arthur van Hoff recalled that Java first became public in late 1994 (Urquhart, 1997; van Hoff, 1998).

Sun formally announced Java and the HotJava browser on May 23, 1995. JavaSoft announced that the Java 1.0 programming environment was available for download on January 23, 1996. The 1.0 announcement refers separately to a March web alpha and the May announcement (Sun Microsystems, 1995; JavaSoft, 1996).

Portability and familiar syntax

Java’s designers wanted developers to distribute the same compiled code across the different machines connected to the Internet. The Java Virtual Machine runs compiled Java code in the form of instructions called bytecode. The class file that carries those instructions uses a format independent of hardware and operating system. Running that code requires a runtime, the software that runs Java programs on the destination system (Gosling, 1997; Lindholm et al., 2025a; Gosling & McGilton, 1996b).

Portability had limits. Van Hoff recalled that supporting each system’s own graphical controls while keeping their behavior consistent proved difficult. Sun designed checks before and during execution to catch possible errors and emphasized the continuing need for quality assurance (van Hoff, 1998; Gosling & McGilton, 1996b).

Who defines what operators do Contested: studies disagree on this

Designers and critics disagreed over who should define what symbols such as + do. In Java, the language defines what arithmetic symbols do. Gosling and McGilton argued that leaving out programmer-defined meanings made code simpler. Thimbleby criticized the rule because Java itself gives the plus sign several meanings (Gosling & McGilton, 1996c; Thimbleby, 1999).

How Java changes

OpenJDK develops changes to the Java platform, and the Java Community Process approves its specifications. A JDK Enhancement Proposal describes a substantial change to the Java Development Kit (JDK). A Java Specification Request describes a proposed or final platform specification and goes to the Java Community Process executive committee for approval. The six-month release schedule for new features began with JDK 10 (Java Community Process, n.d.; Oracle, 2017; Redlich, 2025).

A preview lets programmers try a feature before it becomes permanent or is withdrawn. Records, for example, first appeared in preview in Java 14. String templates appeared in previews in JDK 21 and 22 and were withdrawn for JDK 23 (Oracle, 2025c).

MilestoneWhat changed
2004Generics let code specify the types it works with, such as the element type of a list (Java Community Process, 2004).
2014Lambdas gave programmers a compact way to write an operation they can pass to other code (Java Community Process, 2014).
JDK 9Modules grouped code and data into named units (Oracle, 2017).
JDK 16Records became permanent, offering a shorter way to define classes whose data fields are fixed after creation (Oracle, 2021).
Java 21Virtual threads were intended to ease writing and maintaining programs that handle many tasks at once (Oracle, 2023).

Generics and type erasure

Generics let programmers express what types a piece of code works with. For example, List<String> specifies a list of text values. In List<?>, the question mark is a wildcard. It lets code accept a list without specifying the element type (Java Community Process, 2004; Oracle, 2025e).

Java’s designers wanted existing classes to gain type parameters, which stand for types such as String. They wanted existing source and compiled code to keep working with those classes. Their approach used type erasure, which maps types with parameters to types without them. For example, the erased type of List<String> is List (Goetz, 2020; Bracha et al., 1998; Oracle, 2025e).

Erasure limits which type rules a program can express. A programmer cannot require a type to satisfy two versions of the same generic interface that differ only in their type arguments. That restriction did not arise when the same researchers implemented a graph library (Garcia et al., 2007).

Adoption in existing projects Weak evidence: few or small studies support this

Evidence about who drove adoption comes from a study of 40 popular open-source Java projects. In those projects, one contributor usually led adoption. Generics also sometimes reduced casts, expressions that tell Java to treat a value as a particular type (Parnin et al., 2012).

Checked exceptions

Java uses exceptions to signal failures and other events that interrupt the normal course of a program. Before the program runs, Java checks whether a method, a named operation, accounts for the checked exceptions it can produce. The method can catch the exception by providing code to handle it, or declare it so callers can account for it. The language specification says this rule aims to reduce improperly handled exceptions (Oracle, 2025d).

Reliability and changes to interfaces Contested: studies disagree on this

Designers disagree about whether the obligation is worth the cost to callers. Gosling traced the rule to the Modula-3 language and considered the extra work worthwhile. Anders Hejlsberg argued that adding a checked exception to a published method can force callers to change their code (Gosling, 1997; Venners & Eckel, 2003).

Developers sometimes provide an empty handler, which catches an exception and does nothing with it. In a survey, developers often recalled fixing bugs caused by empty handlers. A sample of reported exception-handling bugs in Eclipse and Tomcat contained few that the researchers attributed to empty handlers (Ebert et al., 2015).

Tests of exceptional behavior also cover both checked and unchecked exceptions, which the compiler permits to go without a declaration. In 1,157 open-source Java projects, 13% of the tests examined covered exceptional behavior. Those tests covered unchecked exceptions twice as often as checked ones (Oracle, 2025d; Marcilio & Furia, 2021).

Null references

A reference identifies an object or holds null to indicate its absence. Trying to call a method on that absent object raises a NullPointerException. In a study of 810 open-source Java systems, 35% of conditional statements contained checks for null (Oracle, 2025a; Osman et al., 2016).

A method that may have no result can return an Optional. This is a container that explicitly represents an absent value or holds a non-null value (Oracle, 2025b).

Checking code and reproducing failures Weak evidence: few or small studies support this

The authors of one null checker, NullAway, compared how much time different checkers added to a build. With NullAway, builds took 1.15 times as long as without a checker. The other checkers took 2.8 to 5.1 times as long as that baseline (Banerjee et al., 2019). In a benchmark of 108 cases from 96 projects, a test generator reproduced 56.9% of known null-pointer failures. Directing it to target those failures raised that share to 78.9% (Lee et al., 2024a).

Java written by coding agents

Errors observed in benchmarks Weak evidence: few or small studies support this

Benchmarks of Java generated by coding agents measure errors in specific tasks. For seven models given baseline prompts on contest problems, incompatible argument types accounted for 1,551 of 3,611 Java compilation-error labels (43.0%). Missing imports accounted for 292 of those labels (8.1%) (Nogueira et al., 2026c).

Failures on short programming tasks can involve invalid positions in a sequence or absent objects. Of 97 Java solutions from ChatGPT that failed to compile or run correctly on LeetCode problems, 45 involved an invalid index and eight involved null references (Liu et al., 2024c).

Static analysis checks code for patterns without running it. In a scan of Java assignment solutions from five models, violations of rules for using programming interfaces accounted for 8.64–19.35% of categorized bug findings per model. The scanner also flagged exception handling and resource cleanup. These counts measure scanner findings, which require review to establish whether they reflect actual defects (Sabra et al., 2025).

Compilation and static checks

Build tools can combine compilation with other checks. Maven compiles Java before running unit tests, and its verify phase can include integration tests and additional quality checks (Apache Maven, n.d.a).

Lint checks warn about code that Java accepts. The javac compiler’s -Xlint options flag raw types, which use a generic type without its type arguments, and operations whose type safety the compiler cannot verify. Other options flag use of deprecated features and features marked for removal (Oracle, n.d.l; Oracle, 2025e).

Additional analyzers look for failures that compilation allows. SpotBugs flags possible failures to close resources such as streams. Error Prone flags ignored futures, objects that represent the results of work that may still be running, because discarding them can hide exceptions (SpotBugs, n.d.; Error Prone, n.d.).

Dependency compatibility

Running in a clean environment tests whether a project works with its declared dependencies, the external packages it uses. In one benchmark, 44% of Java projects made by Claude Code, Codex and Gemini ran as supplied, against 89.2% of Python projects. Among the 75 Java projects, the study reported a missing dependency in one (Vangala et al., 2025).

Upgrading a dependency poses a separate test for an existing project. On the Maven and Java tasks in the DEPBENCH upgrade benchmark, Codex using GPT-5.5 solved 40 of 65 tasks (Luo et al., 2026f).

When a library changes, callers may need changes to their source code or may lose the ability to run code they already compiled. The tool japicmp compares two versions of a Java archive (JAR) and reports these two kinds of compatibility separately (japicmp, n.d.).

Behavior and concurrency tests

Java has test tools for both ordinary behavior and concurrent execution. JUnit can run the same test with different arguments (JUnit Team, n.d.). OpenJDK’s jcstress provides a test runner and suite for checking how Java’s runtime and libraries behave when work runs concurrently (OpenJDK, n.d.).

Limits of concurrency checks

Weak evidence

Concurrent Java programs can still contain defects after compilation and automated checks pass. In one benchmark, the checks used compilation and a tool that explores possible execution orders up to a limit. Manual inspection of 115 passing programs found cases where threads, which carry out tasks independently, ended improperly or failed to interact as required (Huang et al., 2026b).

Verification and contract completeness

A formal verification tool checks the requirements a contract expresses. In Java, the Java Modeling Language lets developers write such requirements in structured comments or annotations. In one study, OpenJML assessed AI-generated contracts of this kind (OpenJML, n.d.; Ma et al., 2025b).

Missing requirements in verified contracts

Weak evidence

A contract can omit required behavior and still pass verification. In the SpecEval benchmark, 37 of 107 verified pairs of conditions generated by SpecGen left out requirements expressed by human-written contracts. Each pair specifies what must hold before and after a method runs (Huang et al., 2026i).

Learning Java

Studies of beginners measure different kinds of difficulty. An analysis of syntax errors in work submitted by 715 first-year students concluded that Python’s syntax was easier to grasp than Java’s. Across nearly identical assignments in 56 introductory courses using Python, C++ or Java, Python students showed no reduction in median completion time or number of attempts (Lokkila et al., 2023; Gordon et al., 2022).

In a study of projects made with BlueJ, a tool for writing and running Java programs, novices used a relatively narrow subset of the language. Java 25 made compact source files and a simpler way to specify where a program starts permanent after four preview releases (Brown et al., 2023b; Oracle, 2025c).

Further reading

  • Gosling et al. (1996) recounts the change from Oak to Java in the first language specification.
  • Gosling (1997) explains the original rationale for portable compiled code.
  • Bracha et al. (1998) describes how the design that preceded Java generics translated code with type parameters.
  • Oracle (2025c) traces language changes through preview and permanent releases.

Known gaps

What this article cannot tell you yet.

  1. Present-day uses and popularity, including how they have changed over time, were outside the coverage of this article.
  2. Java’s licensing and legal history are outside the coverage of this article.
  3. The frequency with which type erasure limits everyday Java development and the concentration of generics adoption across contributors lack independent field estimates here.
  4. It remains unclear whether requiring developers to account for checked exceptions reduces production defects. The effect of adopting Optional on null-related failures also remains unclear.
  5. How often coding agents introduce compilation, runtime and concurrency errors in existing Java projects remains unclear.
  6. It remains unclear how many real defects Java static analyzers catch or how often they raise false alarms on changes made by coding agents.
  7. The cost of writing and maintaining formal contracts in agent-edited Java projects remains unclear.

References

Solid source
Rated highly trustworthy by the research, and every passage taken from it was found in it.
Weak source
Rated low, or a passage taken from it was not found in it.
Medium trust
Rated medium by the research.
Not checked
Rated high, but its passages could not all be checked against it.
Show all 54 references