ReviseAlgo Logo

Modern Java Features

11 Topics
1

var Keyword

Learn Local Variable Type Inference (var) introduced in Java 10.

Tests compiler rules regarding var: where it is allowed (local variables only) and where it is prohibited (fields, methods).
2

Text Blocks

Write multi-line string literals easily using Text Blocks introduced in Java 15.

Tests text block syntax: indentation strip rules, line terminations, and using escape characters.
3

Switch Expressions

Learn modern Switch Expressions with arrow syntax and exhaustiveness checks.

Commonly tested on arrow syntax, returning values using yield, and compiler exhaustiveness checks.
4

Record Classes

Create immutable data carrier classes using Records introduced in Java 16.

Commonly tested on Record structure: immutability rules, custom constructor declarations, and inheritance restrictions.
5

Sealed Classes

Control class hierarchies using Sealed Classes introduced in Java 17.

Tests sealed class rules: permits declarations, subclass rules (final, sealed, non-sealed), and exhaustiveness integration.
6

Pattern Matching

Learn pattern matching for instanceof and switch blocks introduced in Java 17-21.

Focuses on smart casting scopes, pattern variables, and guarding switch conditions with 'when'.
7

Virtual Threads

Understand Java 21 Virtual Threads (Project Loom) for high-scale concurrency.

Highly tested: platform threads vs virtual threads, thread pinning, and why thread pooling is an anti-pattern for virtual threads.
8

Structured Concurrency

Manage concurrent tasks as a single unit of work using Structured Concurrency (Preview).

Tests how structured concurrency resolves thread leaks, task cancellation propagation, and error containment.
9

Stream Gatherers

Extend Stream pipelines with custom intermediate operations using Stream Gatherers.

Focuses on comparing custom collectors with gatherers, and using built-in gatherers (windowFixed, sliding).
10

Foreign Function & Memory API

Interact with native memory off-heap and invoke C libraries safely using the Foreign Function & Memory API (Java 22).

Compares FFM API to JNI, and details off-heap memory safety (Arena and Segment Allocators).
11

Unnamed Patterns and Variables

Learn to use the underscore character (_) for unused variables in pattern matching and catch blocks.

Commonly tested on compiler rules: where underscore is allowed as a variable placeholder (Java 22).