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

System.nanoTime — measuring elapsed time

System.nanoTime() returns a long reading in nanoseconds. Subtract readings to measure elapsed time, not a date.

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

TemporalAdjusters: next weekday and month end

Apply calendar rules through LocalDate.with(...). Distinguish next from nextOrSame and find the last day of a month with lastDayOfMonth, without modifying the input date.

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

Thread.getName — reading a thread's name

Thread.getName() returns the specified thread's name as a String. The method takes no arguments and does not start the thread.

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

Thread.join — Wait for a thread to terminate

Use `Thread.join` to wait for a thread to terminate. Learn which overloads confirm termination and when the waiting thread can safely read the worker’s result.

Intermediate · Java SE 21
Java

Thread: starting, joining, and interrupting

Create platform threads from Runnable tasks, start them once, read their results after joining, and handle cooperative cancellation without losing interrupt status.

Advanced · Java SE 21
Java

Thread.onSpinWait — a hint for busy-wait loops

Thread.onSpinWait() tells the runtime that a loop is busy-waiting. It may enable an optimization, but it neither replaces synchronization nor guarantees a speedup.

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

ThreadPoolExecutor: a bounded pool and CallerRunsPolicy

ThreadPoolExecutor manages a worker pool and a task queue. Learn when it creates threads or queues work, how ThreadPoolExecutor.CallerRunsPolicy handles overload, and how shutdown() and awaitTermination() support orderly termination.

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

Thread.setName — rename a thread

Give worker threads names such as `worker1`, `worker2`, and `worker3` so you can tell them apart in logs and while debugging.

Intermediate · Java SE 21
Java

Thread.start(): starting a thread

`Thread.start()` schedules code to run in a separate thread. Calling `run()` directly does not start a thread; use `join()` when you need to wait for it to finish.

Intermediate · Java SE 21
Java

TreeMap(): natural key ordering and grouping

`TreeMap()` creates an empty map that sorts keys by their natural order. Use `TreeMap::new` as the map supplier when `groupingBy` should return sorted group keys.

Intermediate · Java SE 21
Java

WeakReference — a weak reference to an object

WeakReference<T> holds a weak reference that does not prevent the garbage collector from reclaiming an object. Reading it through get() may return null; clear() clears the reference without destroying the object itself.

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