Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / Knowledge base

Knowledge base

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

Entries: 5788

Java

Fluent builder with self type

A generic self type keeps subclass-specific methods available after inherited fluent calls. The terminal `build()` call creates a separate product from the builder’s current state.

Advanced · Java SE 21
Java

Functions and functional interfaces in Java

Functions and functional interfaces in Java: Java represents behavior with methods and with lambdas or method references targeted to a functional interface having one abstract method.

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

Generic method inference and boxing

Java can infer a generic method’s type arguments from the call arguments and, where applicable, the expected result type. Boxing lets an `int` argument take part in such a call as an `Integer`, not as a primitive type argument.

Advanced · Java SE 21
Java

Generics in Java

Generics in Java: Generics provide compile-time checking, while type erasure removes most type arguments and inserts casts or bridge methods; generic method inference derives arguments from parameters and the target type.

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

Heap pollution in generic varargs

An `Object[]` alias lets a `List<Integer>` replace a `List<String>` in a varargs array. The store succeeds, and no exception occurs unless the element is read as a `String`.

Advanced · Java SE 21
Java

I/O and serialization in Java

I/O and serialization in Java: Java I/O covers InputStream/OutputStream bytes, Reader/Writer characters with Charset, NIO files through Path/Files, and Serializable object graphs through ObjectOutput and ObjectInput.

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

Iterators and traversal in Java

Iterators and traversal in Java: Iterable supplies the Iterator used by enhanced for; Iterator advances with hasNext/next and may remove the last returned element through optional remove.

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

Linear search in Java

Linear search in Java: Linear search in Java examines elements in sequence until a match; List.indexOf uses equals and returns the lowest matching index or -1.

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

Loops and iteration in Java

Loops and iteration in Java: Java provides while with a pre-test, do-while with a post-test, basic for, and enhanced for translated for arrays or Iterable sources.

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

LRU cache through access order

Use an access-ordered `LinkedHashMap` to evict the least recently accessed entry when the cache exceeds its size limit, rather than evicting the first entry inserted.

Intermediate · Java SE 21
Java

References, copies, and memory in Java

References, copies, and memory in Java: In Java a reference variable denotes an object, so assignment or argument passing copies the reference rather than copying the object itself.

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

Modules and their boundaries in Java

Modules and their boundaries in Java: The Java module system groups packages in a named module described by module-info.java; requires controls readability, exports type access, and opens deep reflection.

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

Numeric types and arithmetic in Java

Numeric types and arithmetic in Java: Java has integral byte, short, int, long, and char plus floating-point float and double; integer arithmetic wraps at fixed width, while float and double follow IEEE 754.

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

Copy constructors, shallow copies, and deep copies

A copy constructor creates a new instance from an existing one. A shallow copy still shares nested objects, while a deep copy separates the mutable state covered by the copy contract.

Advanced · Java SE 21
Java

Java object model

Java object model: Java’s object model combines single class inheritance, multiple interfaces, and composition; a static nested class has no enclosing instance, while an inner class does.

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

Performance and measurement in Java

Performance and measurement in Java: Java performance depends first on algorithmic complexity and data structures, then on allocation, locality, synchronization, GC, and JIT optimization.

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

Java program entry point

Java program entry point: The standard Java SE entry point is public static void main(String[] args); spelling the parameter as String... args has the same launcher signature.

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

Reactive streams and backpressure in Java

Reactive streams and backpressure in Java: Java 21 exposes the reactive-streams contract through Flow.Publisher, Subscriber, Subscription, and Processor, with demand controlled by request(long).

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

Records and aggregate values in Java

Records and aggregate values in Java: A Java 21 record is a nominal, shallowly immutable aggregate class: its component list determines private final fields, public accessors, a canonical constructor, and equals, hashCode, and toString.

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

Records and sealed hierarchies

Records and sealed hierarchies: A record declares a nominal data carrier: components produce private final fields, accessors, a canonical constructor, and value-based equals, hashCode, and toString; a record is implicitly final.

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

Recursion and the call stack

Recursion and the call stack: Recursion occurs when a method calls itself directly or indirectly; every invocation owns a stack frame, so the algorithm needs a base case and progress.

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

Reductions and statistics

Reductions and statistics: A reduction combines elements into a result, while IntSummaryStatistics gathers count, sum, min, max, and average in one traversal of an integer stream.

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

Reflection in Java

Reflection in Java: Reflection exposes runtime metadata and dynamic construction, field access, and method invocation through Class, Method, Field, and Constructor.

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