The Java API (Application Programming Interface) is the set of ready-made classes, interfaces, enums and packages that ship with the Java Platform, Standard Edition (Java SE). It gives every Java program a standard library for strings, collections, input and output, networking, concurrency, dates, and more. You do not install it separately: it comes with the JDK, and its official reference is the Javadoc for your Java version.
Since Java 9 the API is organized into modules (java.base, java.sql, java.net.http, and others), and the packages inside them are what you import in code.
The core of the API lives in the java.base module, which every program uses. Common packages:
| Package | Purpose | Typical types |
|---|---|---|
java.lang | Fundamentals, imported automatically | String, Math, Object, Thread, Record |
java.util | Collections and utilities | List, Map, Optional, Scanner |
java.util.stream | Stream processing | Stream, Collectors |
java.io and java.nio.file | Input and output, files | InputStream, Files, Path |
java.net.http | HTTP client (Java 11+) | HttpClient, HttpRequest |
java.time | Modern date and time | LocalDate, Instant, Duration |
java.util.concurrent | Concurrency | ExecutorService, CompletableFuture |
java.sql | Database access with JDBC | Connection, PreparedStatement |
Third-party libraries (Spring, Guava, Jackson) are not part of the Java API, even though you call them in a similar way.
Classes in java.lang are available without an import. Everything else needs an import, or a fully qualified name.
The program uses List.of and stream from java.util, Collectors from java.util.stream, LocalDate from java.time, and String from java.lang. None of them required extra dependencies.
The API includes an HTTP client since Java 11, so a simple request needs no external library.
The Javadoc is the official API documentation, generated from the source. Each page shows the class hierarchy, constructors, methods, the version in which a feature was added (@since), and deprecation notices.
@since and deprecation notes before using a method.Choosing the documentation for the same version as your JDK matters, because methods are added across releases.
| Term | Meaning |
|---|---|
| Java API | The standard classes and interfaces you call from code |
| JVM | The virtual machine that runs bytecode |
| JRE | The runtime: JVM plus the API classes (not distributed separately by Oracle since Java 11) |
| JDK | Compiler, tools and runtime, everything needed to develop |
The API evolves with each six-month release. Long-term support (LTS) versions such as Java 21 and Java 25 are the common production targets. Features can appear as preview APIs that require --enable-preview, and old pieces get deprecated or removed. Examples: Applet (deprecated for removal), Thread.stop() and finalize() (deprecated), and the Java EE modules (CORBA, JAXB, removed in Java 11 and moved to Jakarta EE). Check the deprecation notes in the Javadoc before relying on an old class.
Mostly. The Java API is the public, documented surface of the standard class library. The library also contains internal classes in sun.* or jdk.internal.* packages, which you should not use.
No. String, Math, System and other java.lang types are imported automatically.
On the Oracle Java documentation site and in the OpenJDK Javadoc, with one version per release. IDEs also show it inline.
No. A REST API is a web interface exposed by a service. The Java API is the library you program against inside a Java application, although the Java API includes tools (like HttpClient) to call REST APIs.
The Java API is the standard library that comes with the JDK, organized in modules and packages such as java.lang, java.util, java.io, java.time and java.net.http. Learn to read the Javadoc for your Java version, prefer standard classes before adding dependencies, and watch deprecation notes as the platform evolves.