Java
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).
| Milestone | What changed |
|---|---|
| 2004 | Generics let code specify the types it works with, such as the element type of a list (Java Community Process, 2004). |
| 2014 | Lambdas gave programmers a compact way to write an operation they can pass to other code (Java Community Process, 2014). |
| JDK 9 | Modules grouped code and data into named units (Oracle, 2017). |
| JDK 16 | Records became permanent, offering a shorter way to define classes whose data fields are fixed after creation (Oracle, 2021). |
| Java 21 | Virtual 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.
First published ; last updated .
Known gaps
What this article cannot tell you yet.
- Present-day uses and popularity, including how they have changed over time, were outside the coverage of this article.
- Java’s licensing and legal history are outside the coverage of this article.
- The frequency with which type erasure limits everyday Java development and the concentration of generics adoption across contributors lack independent field estimates here.
- 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.
- How often coding agents introduce compilation, runtime and concurrency errors in existing Java projects remains unclear.
- It remains unclear how many real defects Java static analyzers catch or how often they raise false alarms on changes made by coding agents.
- 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
- Banerjee, S., Clapp, L., & Sridharan, M. (2019). NullAway: Practical type-based null safety for Java. Proceedings of the 2019 27th ACM Joint Meeting on European Software Engineering Conference and Symposium on the Foundations of Software Engineering. https://arxiv.org/abs/1907.02127 Medium trust Preprint, abstract only.
- Bracha, G., Odersky, M., Stoutamire, D., & Wadler, P. (1998). Making the future safe for the past: Adding genericity to the Java programming language. OOPSLA ’98. https://david.stoutamire.com/oopsla98.pdf Solid source Peer-reviewed, read in large part.
- Brown, N. C. C., Weill-Tessier, P., Sekula, M., Costache, A., & Kölling, M. (2023b). Novice use of the Java programming language. ACM Transactions on Computing Education, 23(1), Article 10. https://twistedsquare.com/Novice-Java-Use.pdf Solid source Peer-reviewed, read in large part.
- Computer History Museum (2001). The story of Java. Computer History Museum. https://computerhistory.org/events/story-java/ Medium trust Read in large part.
- Computer History Museum (n.d.). James Gosling. Computer History Museum. https://computerhistory.org/profile/james-gosling/ Medium trust Read in large part.
- Ebert, F., Castor, F., & Serebrenik, A. (2015). An exploratory study on exception handling bugs in Java programs. Journal of Systems and Software, 106, 82–101. https://research.tue.nl/en/publications/an-exploratory-study-on-exception-handling-bugs-in-java-programs/ Solid source Peer-reviewed, abstract only.
- Error Prone (n.d.). Bug patterns. Error Prone. https://errorprone.info/bugpatterns Solid source Documentation, read in large part.
- Garcia, R., Järvi, J., Lumsdaine, A., Siek, J., & Willcock, J. (2007). An extended comparative study of language support for generic programming. Journal of Functional Programming, 17(2), 145–205. https://www.cambridge.org/core/services/aop-cambridge-core/content/view/C97D5964ECC2E651EEF9A70BC50600A6/S0956796806006198a.pdf/an-extended-comparative-study-of-language-support-for-generic-programming.pdf Solid source Peer-reviewed, read in large part.
- Goetz, B. (2020). Background: How we got the generics we have. OpenJDK. https://cr.openjdk.org/~briangoetz/valhalla/erasure.html Medium trust Blog post, read in large part.
- Gordon, C., Lysecky, R., & Vahid, F. (2022). Programming learners struggle as much in Python as in C++ or Java. ASEE Annual Conference. https://www.zybooks.com/wp-content/uploads/2023/04/programming-learners-struggle-as-much-in-python-as-in-c-or-java.pdf Solid source Peer-reviewed, read in large part.
- Gosling, J., & McGilton, H. (1996b). The Java language environment: Architecture neutral, portable, and robust. Sun Microsystems. https://www.oracle.com/java/technologies/architecture-neutral-portable-robust.html Solid source Documentation, read in large part.
- Gosling, J., Joy, B., & Steele, G. (1996). The Java language specification: Preface to the first edition. Addison-Wesley. https://docs.oracle.com/javase/specs/jls/se6/html/j.preface.html Solid source Documentation, read in large part.
- Gosling, J., & McGilton, H. (1996a). The Java language environment. Sun Microsystems. https://www.oracle.com/java/technologies/introduction-to-java.html Solid source Documentation, read in large part.
- Gosling, J., & McGilton, H. (1996c). The Java language environment: Java, simple and familiar. Sun Microsystems. https://www.oracle.com/java/technologies/simple-familiar.html Medium trust Documentation, read in large part.
- Gosling, J. (1997). The feel of Java. Computer. https://horstmann.com/corejava/feel-of-java.pdf Medium trust Peer-reviewed, read in large part.
- Huang, D., Sun, Z., Huang, H., Jiang, J., Xie, X., Huo, Y., et al. (2026i). Path2Spec: Path-aware specification generation via large language models. arXiv. https://arxiv.org/html/2609.33438v1 Medium trust Preprint, read in large part.
- Huang, J., Mahmud, T., Pasareanu, C., & Yang, G. (2026b). CONCUR: Benchmarking LLMs for concurrent code generation. arXiv. https://arxiv.org/html/2603.03683v1 Medium trust Preprint, read in large part.
- japicmp (n.d.). japicmp. japicmp. https://siom79.github.io/japicmp/ Solid source Documentation, read in large part.
- JavaSoft (1996). JavaSoft ships Java 1.0. Sun Microsystems press release. https://javaalmanac.io/jdk/1.0/pressrelease.pdf Weak source Vendor page, read in large part.
- Java Community Process (2004). JSR 14: Add generic types to the Java programming language. Java Community Process. https://jcp.org/en/jsr/detail?id=14 Solid source Documentation, read in large part.
- Java Community Process (2014). JSR 335: Lambda expressions for the Java programming language. Java Community Process. https://jcp.org/en/jsr/detail?id=335 Solid source Documentation, read in large part.
- Java Community Process (n.d.). Governance. Java Community Process. https://jcp.org/en/press/news/Governance Solid source Documentation, read in large part.
- JUnit Team (n.d.). JUnit 5 user guide. JUnit. https://docs.junit.org/5.13.4/user-guide/ Solid source Documentation, read in large part.
- Lee, M., Bak, J., Moon, S., Jhi, Y. C., & Oh, H. (2024a). Effective unit test generation for Java null pointer exceptions. Proceedings of the 39th ACM/IEEE International Conference on Automated Software Engineering, 1044–1056. https://pure.korea.ac.kr/en/publications/effective-unit-test-generation-for-java-null-pointer-exceptions/ Solid source Peer-reviewed, abstract only.
- Lindholm, T., Yellin, F., Bracha, G., Buckley, A., & Smith, D. (2025a). The Java virtual machine specification, Java SE 25 edition, chapter 1: Introduction. Oracle. https://docs.oracle.com/javase/specs/jvms/se25/html/jvms-1.html Solid source Documentation, read in large part.
- Liu, Y., Le-Cong, T., Widyasari, R., Tantithamthavorn, C., Li, L., Le, X. D., et al. (2024c). Refining ChatGPT-generated code: Characterizing and mitigating code quality issues. ACM Transactions on Software Engineering and Methodology. https://arxiv.org/html/2307.12596 Solid source Peer-reviewed, read in large part.
- Lokkila, E., Christopoulos, A., & Laakso, M. (2023). A data-driven approach to compare the syntactic difficulty of programming languages. Journal of Information Systems Education. https://jise.org/Volume34/n1/JISE2023v34n1pp84-93.pdf Solid source Peer-reviewed, abstract only.
- Luo, Z., He, R., Gao, P., Kang, Y., Lin, Z., Ma, M., et al. (2026f). Update from hell: Can coding agents survive hidden breakage in dependency upgrades? arXiv. https://arxiv.org/html/2608.30300v3 Medium trust Preprint, read in large part.
- Ma, L., Liu, S., Li, Y., Xie, X., & Bu, L. (2025b). SpecGen: Automated generation of formal program specifications via large language models. arXiv. https://arxiv.org/html/2401.08807 Medium trust Preprint, read in large part.
- Marcilio, D., & Furia, C. A. (2021). How Java programmers test exceptional behavior. 18th International Conference on Mining Software Repositories. https://2021.msrconf.org/details/msr-2021-technical-papers/21/How-Java-Programmers-Test-Exceptional-Behavior Solid source Peer-reviewed, abstract only.
- Apache Maven (n.d.a). Introduction to the build lifecycle. Apache Maven. https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle Solid source Documentation, read in large part.
- Nogueira, R. P., Vieira, M., & Campos, J. R. (2026c). Unreliable in practice? A comprehensive study of errors in LLM-generated code. arXiv. https://arxiv.org/html/2608.00661 Solid source Preprint, read in large part.
- OpenJDK (n.d.). Java Concurrency Stress (jcstress). GitHub. https://github.com/openjdk/jcstress Solid source Documentation, read in large part.
- OpenJML (n.d.). Introduction to OpenJML. OpenJML. https://www.openjml.org/documentation/introduction.html Solid source Documentation, read in large part.
- Oracle (2017). What’s new in Oracle JDK 9. Oracle. https://docs.oracle.com/javase/9/whatsnew/ Solid source Documentation, read in large part.
- Oracle (2021). JDK 16 release notes. Oracle. https://www.oracle.com/java/technologies/javase/16-relnote-issues.html Solid source Documentation, read in large part.
- Oracle (2023). Virtual threads. Java Platform, Standard Edition 21 Core Libraries. https://docs.oracle.com/en/java/javase/21/core/virtual-threads.html Solid source Documentation, read in large part.
- Oracle (2025e). The Java language specification, Java SE 25 edition, chapter 4: Types, values, and variables. Oracle. https://docs.oracle.com/javase/specs/jls/se25/html/jls-4.html Solid source Documentation, read in large part.
- Oracle (2025d). The Java language specification, Java SE 25 edition, chapter 11: Exceptions. Oracle. https://docs.oracle.com/javase/specs/jls/se25/html/jls-11.html Solid source Documentation, read in large part.
- Oracle (2025b). Class Optional<T>. Java SE 25 and JDK 25 API Specification. https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/util/Optional.html Solid source Documentation, read in large part.
- Oracle (2025a). Class NullPointerException. Java SE 25 and JDK 25 API Specification. https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/NullPointerException.html Solid source Documentation, read in large part.
- Oracle (2025c). Java language changes by release. Oracle. https://docs.oracle.com/en/java/javase/25/language/java-language-changes-release.html Solid source Documentation, read in large part.
- Oracle (n.d.l). The javac command. Java Platform, Standard Edition 25. https://docs.oracle.com/en/java/javase/25/docs/specs/man/javac.html Solid source Documentation, read in large part.
- Osman, H., Leuenberger, M., Lungu, M., & Nierstrasz, O. (2016). Tracking null checks in open-source Java systems. 2016 IEEE 23rd International Conference on Software Analysis, Evolution, and Reengineering, 304–313. https://pure.rug.nl/ws/files/32629186/Osma16a.pdf Solid source Peer-reviewed, read in large part.
- Parnin, C., Bird, C., & Murphy-Hill, E. (2012). Adoption and use of Java generics. Empirical Software Engineering. https://www.researchgate.net/publication/236644412_Adoption_and_Use_of_Java_Generics Solid source Peer-reviewed, read in large part.
- Redlich, M. (2025). The latest in OpenJDK and JCP expert group: Insights with Simon Ritter. InfoQ. https://www.infoq.com/podcasts/latest-open-java-development-kit/ Medium trust News article, read in large part.
- Sabra, A., Schmitt, O., & Sonar, J. T. (2025). Assessing the quality and security of AI-generated code: A quantitative analysis. arXiv. https://arxiv.org/html/2508.14727v1 Medium trust Preprint, read in large part.
- SpotBugs (n.d.). Bug descriptions. SpotBugs 4.10.5 documentation. https://spotbugs.readthedocs.io/en/stable/bugDescriptions.html Solid source Documentation, read in large part.
- Sun Microsystems (1995). Sun brings true interactivity to the World Wide Web. SunFlash. https://groups.google.com/g/comp.unix.solaris/c/axPF4Jka_ts Medium trust Vendor page, read in large part.
- Thimbleby, H. (1999). A critique of Java. Software: Practice and Experience. https://harold.thimbleby.net/cv/files/javaspae.html Medium trust Peer-reviewed, read in large part.
- Urquhart, K. (1997). Java standardization. JavaSoft. https://sunsite.icm.edu.pl/pub/programming/java/javasoft-docs/papers/javastd.pdf Solid source Documentation, read in large part.
- Vangala, B. P., Adibifar, A., Malik, T., & Gehani, A. (2025). AI-generated code is not reproducible (yet): An empirical study of dependency gaps in LLM-based coding agents. arXiv. https://arxiv.org/html/2512.22387v1 Solid source Preprint, read in large part.
- van Hoff, A. (1998). Java: Getting down to business. Dr. Dobb’s Journal. https://jacobfilipp.com/DrDobbs/articles/DDJ/1998/9801/9801a/9801a.htm Medium trust Read in large part.
- Venners, B., & Eckel, B. (2003). The trouble with checked exceptions. Artima. https://www.artima.com/articles/the-trouble-with-checked-exceptions Medium trust Read in large part.