Java SE 8 Programmer II study materials
Java SE 8 Programmer II study resources

Java SE 8 Programmer II key terms

Java SE 8 Programmer II · Get comfortable with the vocabulary.

Encapsulation

Bundling instance fields with the methods that operate on them and hiding the fields behind private access, exposing behavior through public methods. It lets a class enforce its own invariants and change internal representation without breaking callers.

Related: Immutability, Polymorphism
Immutability

A design property where an object's state cannot change after construction, achieved with final fields, no setters, and defensive copying. Immutable objects are inherently thread-safe and safe to share across threads and collections.

Related: Encapsulation, Defensive Copying
Defensive Copying

Making a private copy of a mutable object received or returned by a method so callers cannot modify internal state through a retained reference. Commonly applied to arrays, Date, and collection constructor parameters.

Related: Immutability
Polymorphism

The ability to treat objects of different subclasses through a common supertype reference, with the actual method executed chosen at runtime by dynamic dispatch. Enables extensible code that depends on abstractions rather than concrete classes.

Related: Overriding, Abstract Class
Overriding

Redefining an inherited instance method in a subclass with a compatible signature, return type, and no more restrictive access. The override is selected at runtime; annotations and access rules catch many mistakes at compile time.

Related: Polymorphism, Covariant Return Type
Covariant Return Type

Allowing an overriding method to declare a return type that is a subtype of the overridden method's return type. Legal since Java 5 and useful for fluent builders and clone-style methods.

Related: Overriding
Abstract Class

A class declared abstract that cannot be instantiated and may declare abstract methods subclasses must implement. It supports shared state and partial implementation, unlike an interface's pre-Java 8 restrictions.

Related: Interface Default Method, Polymorphism
Interface Default Method

A method in an interface declared with the default keyword that supplies an implementation classes inherit unless they override it. It enables adding methods to published interfaces without breaking existing implementors.

Related: Abstract Class, Functional Interface
Static Interface Method

A method declared static inside an interface, invoked only through the interface name and not inherited by implementing classes. Useful for utility factories tied to the interface's type.

Related: Interface Default Method
Functional Interface

An interface with exactly one abstract method, optionally annotated @FunctionalInterface. Lambdas and method references can implement it, and the compiler infers the target type from context.

Related: Lambda Expression, Method Reference
Lambda Expression

A concise anonymous implementation of a functional interface, written as parameters, an arrow, and a body. It captures effectively final local variables and compiles to an invokedynamic call site rather than a separate class file.

Related: Functional Interface, Effectively Final
Effectively Final

A local variable or parameter whose value is never reassigned after initialization, making it eligible for capture by a lambda or local class. The final keyword is not required.

Related: Lambda Expression
Method Reference

A shorthand lambda of the form Type::method, Class::instanceMethod, object::method, or Class::new that reuses an existing method as a functional interface implementation.

Related: Functional Interface, Lambda Expression
Type Erasure

The compiler's process of removing generic type parameters, inserting casts, and generating bridge methods so generic code runs on raw types at runtime. Explains why instanceof List and new T() are illegal.

Related: Bounded Type Parameter, Wildcard
Bounded Type Parameter

A generic declaration restricting a type argument, as in <T extends Comparable>, granting access to the bound's members. Multiple bounds use & with at most one class, listed first.

Related: Type Erasure, Wildcard
Wildcard

The ? placeholder in generic type arguments, optionally bounded as ? extends T for reading or ? super T for writing. Follows the PECS rule: producer extends, consumer super.

Related: Bounded Type Parameter, Type Erasure
Comparable

An interface whose single compareTo method defines a class's natural ordering, used by sorted collections and Collections.sort. Contract requires consistency with equals for correct behavior in sorted sets and maps.

Related: Comparator, TreeMap
Comparator

A separate comparison object supplying an ordering through compare, allowing multiple orderings per type and use with sort, TreeSet, and TreeMap. Java 8 added default methods like comparing, reversed, and thenComparing.

Related: Comparable
HashMap

A hash-table-based Map implementation offering constant-time average get and put, no ordering guarantee, one null key, and null values. Keys must implement consistent hashCode and equals.

Related: HashSet, TreeMap
TreeMap

A sorted Map backed by a red-black tree, ordered by natural ordering or a supplied Comparator, with O(log n) operations. It does not permit null keys when using natural ordering.

Related: Comparator, Comparable
HashSet

A Set implementation backed by a HashMap that stores unique elements with no ordering guarantee. Uniqueness depends on the elements' hashCode and equals contracts.

Related: HashMap
Stream Pipeline

A sequence of a source, zero or more lazy intermediate operations, and one terminal operation that triggers execution. A stream can be consumed only once and does not store data.

Related: Intermediate Operation, Terminal Operation
Intermediate Operation

A stream operation such as filter, map, or sorted that returns a new stream and is lazy, doing no work until a terminal operation runs. Stateless operations process elements independently.

Related: Stream Pipeline, Terminal Operation
Terminal Operation

A stream operation such as collect, forEach, reduce, or count that consumes the pipeline and produces a result or side effect. After it runs, the stream is exhausted.

Related: Stream Pipeline, Collector
Collector

An object passed to Stream.collect describing how to accumulate elements into a result, optionally with a supplier, accumulator, combiner, and finisher. Collectors offers ready-made implementations such as toList and groupingBy.

Related: Terminal Operation, Optional
Optional

A container that either holds one non-null value or is empty, used as a return type to signal possible absence without null. Provides map, flatMap, filter, orElse, and orElseThrow.

Related: Collector
Checked Exception

An exception that is a subclass of Exception but not RuntimeException, which the compiler requires to be caught or declared with throws. Used for recoverable conditions the caller should handle.

Related: Unchecked Exception, try-with-resources
Unchecked Exception

A RuntimeException or Error subclass that the compiler does not require to be caught or declared. Usually signals programming errors such as null dereference, bad cast, or illegal argument.

Related: Checked Exception
try-with-resources

A try statement that declares one or more AutoCloseable resources and closes them automatically in reverse declaration order, even when exceptions occur. Suppressed exceptions are attached to the primary exception.

Related: Checked Exception, AutoCloseable
AutoCloseable

An interface declaring a single close method, implemented by resources usable in try-with-resources. Closeable refines it with an IOException-typed close method.

Related: try-with-resources
Assertion

A boolean check written with the assert keyword, enabled only when the JVM runs with -ea and disabled by default. Intended for validating internal invariants during development, never for public argument checking.

Related: Unchecked Exception
Serialization

Converting an object graph to a byte stream via ObjectOutputStream and back with ObjectInputStream. Requires Serializable, uses serialVersionUID for version compatibility, and skips transient fields.

Related: transient
transient

A field modifier excluding that field from default serialization, so it is restored as its default value on deserialization. Often combined with custom readObject and writeObject methods.

Related: Serialization
Console

A java.io object obtained from System.console providing character-based input and password reading without echo. It returns null when no interactive console is attached, such as in many IDE or CI runs.

Related: BufferedReader
BufferedReader

A java.io reader that buffers characters to reduce I/O calls, offering readLine for line-based text input. Usually wrapped around FileReader or InputStreamReader.

Related: Console
Thread Deadlock

A situation where two or more threads each hold a lock the others need and all wait forever. Prevented by consistent lock ordering, timeouts, or avoiding nested lock acquisition.

Related: synchronized, ExecutorService
synchronized

A keyword providing mutual exclusion on an object's monitor for a method or block, also establishing happens-before visibility. It is reentrant, so a thread can reacquire a monitor it already holds.

Related: Thread Deadlock, Atomic Variable
Atomic Variable

A class such as AtomicInteger supporting lock-free thread-safe updates through compare-and-set operations. Preferred over synchronization for simple counters and references under contention.

Related: synchronized
ExecutorService

A thread-management abstraction that accepts tasks and runs them on a pool, decoupling submission from execution. Shut down with shutdown or shutdownNow and typically awaited with awaitTermination.

Related: Thread Deadlock, ForkJoinPool
ForkJoinPool

An executor using work-stealing to run recursive divide-and-conquer tasks efficiently, backing parallel streams. Tasks extend RecursiveTask for results or RecursiveAction for side effects.

Related: ExecutorService, Stream Pipeline
PreparedStatement

A precompiled SQL statement using parameter placeholders, set with typed setters such as setInt and setString. It improves performance on reuse and prevents SQL injection.

Related: ResultSet, CallableStatement
ResultSet

A cursor over query rows returned by executeQuery, starting before the first row and advanced with next. Column values are read by index, which is 1-based, or by label.

Related: PreparedStatement
CallableStatement

A JDBC statement for invoking stored procedures, with parameters registered via registerOutParameter and read after execution with typed getters.

Related: PreparedStatement
ResourceBundle

A container of locale-specific objects loaded by base name plus locale, falling back from specific to default bundles. Properties-based bundles are the common text-localization mechanism.

Related: Locale, MessageFormat
Locale

A class representing a language, country, and optional variant used to select formatting and bundle behavior. Constructed with language tags or constants, and matched via candidate locale lookup.

Related: ResourceBundle, NumberFormat
MessageFormat

A formatter that builds localized messages from patterns containing numbered placeholders, applying locale-specific number and date formatting. Choice patterns select text by numeric value.

Related: ResourceBundle, Locale
NumberFormat

A formatter and parser for locale-sensitive numbers, currencies, and percentages, obtained from factory methods rather than constructors. It also controls grouping and fraction digits.

Related: Locale
Path

The NIO.2 interface representing a hierarchical location of a file or directory, created via Paths.get or a FileSystem. It is immutable, does not require the target to exist, and supports normalization and resolution.

Related: Files, FileSystem
Files

A utility class of static NIO.2 methods for copying, moving, deleting, reading, writing, and inspecting files, plus walking directory trees with a stream. Most methods throw IOException on failure.

Related: Path, FileSystem
FileSystem

The NIO.2 abstraction for a storage system that creates paths, watches for changes, and provides separators. Obtained from FileSystems, allowing zip or in-memory filesystems.

Related: Path, Files
Instant

An immutable point on the UTC timeline with nanosecond precision, the natural bridge between the date-time API and legacy Date. It is not tied to any time zone or calendar.

Related: ZonedDateTime, Duration
ZonedDateTime

A date-time with a full time zone and offset, handling daylight-saving gaps and overlaps. Prefer it over LocalDateTime when the actual instant matters.

Related: Instant, Period
Period

An amount of time expressed in years, months, and days for date-based arithmetic, distinct from a time-based Duration. Adding it to a date adjusts calendar fields, not fixed hours.

Related: Duration, ZonedDateTime
Duration

A time-based amount measured in seconds and nanoseconds, used for differences between instants or times. It differs from Period, which counts calendar days and months.

Related: Period, Instant
DateTimeFormatter

An immutable formatter and parser for date-time objects, built from patterns or localized styles. It is thread-safe, unlike SimpleDateFormat, and throws on invalid patterns.

Related: Instant