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

Using record deconstruction patterns, what does `format(new Point(1, 2))` print?

record Point(int x, int y) {} static String format(Object o) { return switch (o) { case Point(int x, int y) -> "x+y=" + (x + y); default -> "?"; }; }