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

Strings and Unicode

Strings and Unicode: String is an immutable sequence of UTF-16 code units; length counts code units, so a supplementary character occupies two chars but one code point.

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

Deterministic testing

Deterministic testing: A deterministic test arranges input, executes one behavior, and checks an observable result; a unit test isolates the contract of a small unit.

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

Time and zones in Java

Time and zones in Java: The java.time API separates an Instant on the timeline, a Duration, a LocalDate, and a ZonedDateTime governed by ZoneId rules.

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

Type conversions in Java

Type conversions in Java: Java performs implicit widening conversions, while primitive narrowing and reference casts require explicit syntax; boxing connects a primitive with its wrapper.

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

Type erasure and class tokens in Java

Type erasure gives `ArrayList<String>` and `ArrayList<Integer>` the same runtime class, but reflection can still read a type argument from a field declaration.

Advanced · Java SE 21
Java

Java type system

Java type system: Java has a static, nominal type system that distinguishes primitive from reference types and derives subtyping from declared inheritance and interface implementation.

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

Value-based classes and object identity

Compare instances of value-based classes such as LocalDate using equals, not reference identity. Treat equal values as interchangeable and never use them as synchronization locks.

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

Variables and scope in Java

Variables and scope in Java: A Java variable has a declared or inferred type, scope, and lifetime; variables include fields, parameters, local variables, and array components.

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

Virtual threads in Java

Virtual threads in Java: A Java 21 virtual thread is a lightweight Thread implementation scheduled by the JVM for very large numbers of concurrent, mostly blocking tasks.

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

Java byte order: LITTLE_ENDIAN and BIG_ENDIAN

Choose how `ByteBuffer` lays out multibyte values, use the same byte order to write and read them, and distinguish the buffer default from the platform’s native order.

Advanced · Java SE 21
Java

int limits: Integer.MIN_VALUE and Integer.MAX_VALUE

Integer.MIN_VALUE and Integer.MAX_VALUE define the lower and upper bounds of Java's int type. Learn their values and the difference between int overflow and a calculation performed as long.

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

TimeUnit: fixed units of elapsed time

`TimeUnit` provides seven units from nanoseconds to days. Choose the unit that matches an amount, or convert different amounts to a common unit.

Advanced · Java SE 21
Java

NumberFormatException — failed text-to-number conversion

NumberFormatException signals that text cannot be converted to the requested numeric type. With Integer.parseInt, the cause can be either invalid notation or a value outside the int range.

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

UnsupportedOperationException — unsupported operation

UnsupportedOperationException means that the requested operation is not supported. It commonly occurs when attempting to modify an unmodifiable list, such as one created with List.of(...). The solution is to choose an object that supports the required operation, not merely catch the exception.

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

The abstract keyword

The abstract keyword: The abstract keyword marks an incomplete class that cannot be instantiated with new, or a bodyless method that a concrete subclass must implement.

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

The assert statement

The assert statement: The assert statement checks an internal assumption and throws AssertionError on failure, optionally carrying the value of the expression after the colon.

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

The break statement

The break statement: An unlabeled break statement exits the nearest loop or switch statement, while a labeled break transfers control beyond its labeled block or loop.

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

case labels in switch

case labels in switch: A case label selects a switch branch by constant, enum value, String, or type pattern; Java 21 can also handle null explicitly.

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

The catch clause

The catch clause: A catch clause handles an exception thrown from its associated try when the exception’s run-time type is assignable to the declared catch parameter type.

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

class — class declaration

class — class declaration: The class keyword starts a class declaration, a named reference type with fields, methods, constructors, initializers, and member types.

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

const — reserved unused keyword

const — reserved unused keyword: const is a reserved but unused Java keyword; it declares no constant and cannot be used as an identifier.

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

continue — advance to the next iteration

continue — advance to the next iteration: continue ends the current iteration of a while, do, or for loop and transfers control to that loop’s continuation point.

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