Created
December 16, 2021 08:55
-
-
Save agiri23/881770456208b2e831eeb22386e43931 to your computer and use it in GitHub Desktop.
switch case with pattern matching
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void onShow(Country country) { | |
switch (country) { | |
case NETHERLANDS, POLAND, GERMANY -> System.out.println("European Country"); | |
case INDIA, BHUTAN, NEPAL -> System.out.println("Asian Country"); | |
default -> System.out.println("It's from Wakanda"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment