Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumJavapattern matching switch instanceofSingle-choice MCQ

In a pattern switch, a type-pattern case and a more specific guarded case both could match the same value. What determines which branch runs?

static String describe(Object o) { return switch (o) { case Integer i when i > 100 -> "big"; case Integer i -> "int"; default -> "other"; }; }