Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Java

Knowledge base — Java

Programming syntax, operators and concepts. Find an explanation, explore an example and return to learning.

Entries: 813

Java

Math.abs — absolute value

Find the absolute value of a number, compare floating-point values within a tolerance, and handle the smallest integer values correctly.

Basic · Java SE 21
Java

Math.max — the greater of two numbers

Math.max returns the greater of two numbers. Learn its numeric overloads and its behavior for NaN and signed zero.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Math.round — rounding to an integer

Math.round chooses the nearest integer, breaking ties toward positive infinity. The result type depends on the overload.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

MessageDigest — computing and comparing hashes

MessageDigest computes one-way hashes of data. Learn how to select SHA-256, process bytes, understand the reset after digest, and compare results with isEqual.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Neighboring keys in NavigableMap

Find the closest stored key below or above a search key, with or without including a key that compares equal.

Advanced · Java SE 21
Java

Live range views in NavigableMap

Use `subMap`, `headMap`, and `tailMap` to select a key range, explicitly include or exclude its endpoints, and work with the original map rather than a copy.

Advanced · Java SE 21
Java

NoSuchFieldException — failed field lookup

NoSuchFieldException is a checked exception raised when a lookup cannot find a field with the specified name. With reflection, the search scope matters: getField searches public fields, while getDeclaredField searches fields declared directly by the given type.

Intermediate · Java SE 21; repository runtime, production runtime not attested
Java

Number.doubleValue() — convert to double

Get a `Number` object's value as a primitive `double`. Whether the result is exact depends on the object's actual subtype and whether the value can be represented as a `double`.

Basic · Java SE 21
Java

Object.equals — object equality

Object.equals compares object identity by default. Overriding it lets a class define value equality.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Object.getClass(): an object's runtime class

`getClass()` returns the `Class` object for an object's runtime class, regardless of the variable's declared type. It lets you test for an exact class match, but it does not reveal a generic instance's type arguments.

Basic · Java SE 21
Java

Object.hashCode — the hash-code contract

Object.hashCode returns an int used by hash tables. Objects equal according to equals must have matching codes; the reverse does not hold.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Java object serialization to a byte array

Write an object to a `byte[]` and reconstruct it from trusted bytes generated by the same program. See why default serialization omits `transient` fields.

Advanced · Java SE 21
Java

Objects.hash: a hash code from two fields

Combine two fields into an `int` hash code, see why Java autoboxes an `int` to `Integer`, and learn how `Objects.hash` differs from `Objects.hashCode`.

Advanced · Java SE 21
Java

Objects.requireNonNull: checking references

In Java SE 21, `Objects.requireNonNull` returns the same reference if it is not `null`, or throws an exception. It checks that an argument is present, not that its contents are valid.

Advanced · Java SE 21
Java

OptionalDouble: fallback or value retrieval

OptionalDouble represents a double value or its absence. Learn how orElse differs from getAsDouble.

Basic · Java SE 21; repository runtime, production runtime not attested
Java

Optional.empty: practical reference

Optional.empty: practical reference: Optional.empty() returns an empty Optional<T> representing absence, with its type parameter inferred from the invocation context.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Optional.filter: practical reference

Optional.filter: practical reference: Optional.filter(predicate) returns an Optional describing a present value that satisfies the predicate, empty when it does not, and stays empty for an empty receiver.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime
Java

Optional.flatMap: practical reference

Optional.flatMap: practical reference: Optional.flatMap(mapper) returns the Optional produced by the mapper without another wrapper for a present value, and returns empty for an empty receiver.

Intermediate · Java SE 21 (JLS and Java SE API); examples verified on the repository Java runtime