Add java21-features module: runnable demos and captured output for the ankurm.com java21-features article
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
/** Fails to compile on purpose: a more general pattern before a specific one makes the later case unreachable. */
|
||||
public class DominatedCase {
|
||||
static String f(Object o) { return switch (o) { case CharSequence cs -> "cs"; case String s -> "s"; default -> "d"; }; }
|
||||
public static void main(String[] args) { }
|
||||
}
|
||||
Reference in New Issue
Block a user