Package modernfeatures.java17
Class PatternMatchingSwitchDemo
java.lang.Object
modernfeatures.java17.PatternMatchingSwitchDemo
This demo shows pattern matching for switch in Java 17+ using sealed interfaces and records.
It illustrates how switch expressions can be used with pattern matching to handle different
implementations of a sealed interface.
-
Constructor Summary
Constructors -
Method Summary
-
Constructor Details
-
PatternMatchingSwitchDemo
public PatternMatchingSwitchDemo()
-
-
Method Details
-
main
Iterates over different shapes and uses a switch expression with pattern matching to produce a description of each shape.
-