Oracle Java SE 21 study materials
Oracle Java SE 21 study resources

Oracle Java SE 21 key terms

Oracle Java SE 21 · Get comfortable with the vocabulary.

java.time.LocalDate

An immutable java.time class representing a date without a time zone or time of day, holding year, month and day. It is used for plain calendar dates such as birthdays or due dates.

Related: DateTimeFormatter, Period
DateTimeFormatter

A java.time class that defines how date-time objects are turned into text and how text is parsed back into date-time objects, using patterns, locales or predefined constants such as ISO_LOCAL_DATE.

Related: java.time.LocalDate, Period
Period

A date-based amount expressed in years, months and days, used to add to or subtract from LocalDate values. Unlike Duration it works in calendar units rather than elapsed clock time.

Related: Duration, java.time.LocalDate
Duration

A time-based amount measured in seconds and nanoseconds, typically combined with Instant or LocalTime. It measures elapsed clock time and cannot represent months or years.

Related: Period, java.time.LocalDate
BigDecimal

An immutable, arbitrary-precision decimal number class used for exact arithmetic such as money calculations, where binary floating-point types like double would introduce rounding errors. Rounding behaviour is controlled with an explicit RoundingMode.

Switch expression

A form of switch that yields a value instead of only running statements. It uses arrow labels, does not fall through, and must be exhaustive when the selector is an enum or sealed type.

Related: Pattern matching for instanceof, Labeled break
Pattern matching for instanceof

A language feature that lets a type-test expression declare a binding variable which is definitely assigned when the test succeeds, removing the need for an explicit cast on the next line.

Related: Switch expression, Sealed class
Labeled break

A named label placed before a loop that allows break or continue to target an outer loop from inside a nested loop, controlling how far execution unwinds or skips.

Related: Enhanced for loop, Switch expression
Enhanced for loop

The for-each statement that iterates arrays and Iterable objects without exposing an index or iterator. Structurally modifying the collection inside the loop usually throws ConcurrentModificationException.

Related: Labeled break, List.of
Sealed class

A class or interface declared with sealed that restricts which types may extend or implement it. Permitted subtypes are named in a permits clause and must themselves be final, sealed or non-sealed.

Related: Record, Switch expression
Record

A concise, immutable data-carrier class that automatically generates a canonical constructor, accessor methods, equals, hashCode and toString from its declared components. Records are implicitly final and cannot be extended.

Related: Sealed class, equals/hashCode contract
Default method

An interface method with a body marked default, letting interfaces gain behaviour without breaking existing implementors. When a superclass method and a default method conflict, the superclass method wins.

Related: Abstract class, Functional interface
Abstract class

A class that cannot be instantiated and may declare abstract methods that subclasses must implement. It can hold instance state and concrete methods, which distinguishes it from a pure interface.

Related: Default method, Sealed class
Checked exception

An exception that subclasses Exception but not RuntimeException, which the compiler requires callers to catch or declare with a throws clause. It represents expected, recoverable conditions.

Related: try-with-resources, Suppressed exception
try-with-resources

A try statement that declares one or more AutoCloseable resources and closes them automatically in reverse declaration order when the block exits, recording close failures as suppressed exceptions.

Related: Checked exception, Suppressed exception
Multi-catch

A single catch clause handling several unrelated exception types separated by the pipe character. Its parameter is implicitly final and its static type is the least upper bound of the listed types.

Related: Checked exception, Suppressed exception
Suppressed exception

An exception attached to a primary exception when it arises during resource cleanup instead of replacing the original. It is retrieved with getSuppressed rather than being silently lost.

Related: try-with-resources, Checked exception
equals/hashCode contract

The rule that objects equal according to equals must return the same hashCode, so hash-based collections can locate them. Breaking it causes duplicate keys and failed lookups in HashMap and HashSet.

Related: Record, Comparator
Comparable

An interface whose compareTo method defines a class's natural ordering, used by sorted collections and by Arrays.sort and Collections.sort for arrays and lists of that type.

Related: Comparator
Comparator

A functional interface whose compare method supplies an ordering defined outside the class, allowing sorting of types that are not Comparable and composition with thenComparing and reversed.

Related: Comparable, Functional interface
List.of

A static factory returning an unmodifiable, null-rejecting List of the supplied elements. It throws NullPointerException at creation and UnsupportedOperationException on any attempted mutation.

Related: Enhanced for loop, Collector
Functional interface

An interface with exactly one abstract method, which can therefore be implemented by a lambda expression or method reference. It may still declare default and static methods.

Related: Method reference, Comparator
Method reference

A compact syntax such as String::length or System.out::println that points at an existing method and implements a functional interface without writing a lambda body.

Related: Functional interface, Optional
Terminal operation

A stream operation such as collect, forEach, count or reduce that starts pipeline processing and consumes the stream. Intermediate operations like filter and map do nothing until one is invoked.

Related: Collector, Optional
Optional

A container that either holds a value or is empty, intended mainly as a return type signalling a possibly missing result instead of null. It is not meant for fields or method parameters.

Related: Terminal operation, Method reference
Collector

An object describing how to accumulate stream elements into a result such as a list, map or joined string. Instances usually come from the Collectors factory methods and are passed to collect.

Related: Terminal operation, Functional interface
module-info.java

A module descriptor declaring a module's name, the packages it exports, the modules it requires and any services it uses or provides. It sits at the root of the module's source tree.

Related: jlink, JAR manifest
jlink

A JDK tool that assembles a custom runtime image containing only the modules an application actually needs, producing a smaller, self-contained distribution without a full JDK.

Related: module-info.java
JAR manifest

The META-INF/MANIFEST.MF file inside a JAR holding metadata such as Main-Class for executable jars, version information and class path entries read by the java launcher.

Related: module-info.java, jlink
ExecutorService

A concurrency abstraction that manages a pool of worker threads and accepts tasks submitted as Runnable or Callable, separating task submission from thread creation and lifecycle management.

Related: CompletableFuture, synchronized
volatile

A field modifier guaranteeing that reads and writes go to main memory and that other threads observe the latest value, giving visibility and ordering but not atomicity for compound actions.

Related: synchronized, CompletableFuture
synchronized

A keyword that acquires a monitor lock for a block or method, providing mutual exclusion and a happens-before relationship so only one thread at a time runs the guarded code.

Related: volatile, ExecutorService
CompletableFuture

A class representing an asynchronous result that can be completed later, supporting chained transformations and combinations through methods such as thenApply, thenCompose and exceptionally.

Related: ExecutorService, volatile
Path

The java.nio.file interface representing the hierarchical location of a file or directory, independent of the file's content. Instances are created with Path.of and combined via resolve or relativize.

Related: Files, Charset
Files

A utility class of static methods for common file operations, such as reading all lines, writing text, copying, moving, testing existence and walking a directory tree.

Related: Path, Charset
Charset

A named mapping between characters and bytes. Reader and Writer classes accept one so text is decoded and encoded correctly; for example Files.readString assumes UTF-8 by default.

Related: Files, Path
PreparedStatement

A precompiled SQL statement with parameter placeholders filled by typed setter methods, giving protection against SQL injection and better reuse than a plain Statement.

Related: ResultSet, Auto-commit
ResultSet

A cursor over the rows returned by a query. You advance it with next and read columns by index or label; it is closed along with its statement by try-with-resources.

Related: PreparedStatement, DataSource
DataSource

A factory for database connections, usually configured and pooled by a container, preferred over DriverManager because it supports connection pooling and is not tied to a hard-coded URL.

Related: Auto-commit, PreparedStatement
Auto-commit

The default JDBC mode in which each statement forms its own transaction. Disabling it lets several statements be grouped and explicitly committed or rolled back as one unit.

Related: PreparedStatement, DataSource