KEMBAR78
Java Features Flashcards | PDF
0% found this document useful (0 votes)
7 views1 page

Java Features Flashcards

Uploaded by

pibexik122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views1 page

Java Features Flashcards

Uploaded by

pibexik122
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Java Features Flashcards

Java 8 (2014)
Feature Description
Lambda Expressions Enables functional programming using (params) -> expression.
Functional Interfaces Interfaces with one abstract method (e.g., Function, Predicate).
Stream API Functional operations on collections like filter(), map(), reduce().
Default & Static Methods Interface methods with implementation using default and static.
Optional Class Avoids null checks with Optional.of(), Optional.empty().
New Date & Time API Immutable classes like LocalDate, LocalDateTime.
Nashorn Engine Run JavaScript within Java code.
Method References Shorter syntax for lambdas using ClassName::methodName.

Java 17 (2021 - LTS)


Feature Description
Sealed Classes Restrict which classes can extend a class.
Pattern Matching (instanceof) Eliminates need for explicit casting.
Records Concise immutable data carriers with record keyword.
Text Blocks Multiline string literals using triple quotes """.
Switch Expressions Use switch as an expression with arrow syntax.
New Random Generators Enhanced API for pseudo-random number generation.

Java 21 (2023 - LTS)


Feature Description
Virtual Threads Lightweight threads from Project Loom.
Pattern Matching for Switch Use switch with pattern types.
Record Patterns Deconstruct records directly inside conditions.
Sequenced Collections Preserve insertion order (SequencedSet, SequencedMap).
Scoped Values Safe data sharing across threads, alternative to ThreadLocal.
String Templates (Preview) Inline expressions in strings: STR."Hello, {name}".
Unnamed Variables (Preview) Use _ for unused pattern components.

You might also like