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

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
Java

Scope and lifetime

Scope and lifetime: Lexical scope determines where a name is visible, while object lifetime follows reachability; try-with-resources closes a resource deterministically.

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

Security and password hashing

Security and password hashing: Java security requires trust-boundary validation, least privilege, and platform cryptography; password hashing should use a slow KDF rather than raw MessageDigest.

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

Sorting and comparators

Sorting and comparators: List.sort and object Arrays.sort order stably by a Comparator, so elements equal under the order retain their prior encounter order.

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

Staged builder through interfaces

Staged builder through interfaces splits object construction into typed steps. Each stage-transition method returns the next stage's interface, so an ordinary call chain exposes `build()` only after the required inputs have been supplied. This does not replace runtime validation of those inputs.

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

Java Stream pipelines

Java Stream pipelines: A Stream is a single-use lazy pipeline of a source, intermediate operations, and a terminal operation; elements flow only when the terminal requests a result.

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