From 0e2c95a36900fe913f5d768e7f4632034ddf005b Mon Sep 17 00:00:00 2001 From: Andy Clement Date: Wed, 3 Apr 2019 10:23:44 -0700 Subject: Updated with Java12 support --- tests/features193/Switch1.java | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 tests/features193/Switch1.java (limited to 'tests/features193/Switch1.java') diff --git a/tests/features193/Switch1.java b/tests/features193/Switch1.java new file mode 100644 index 000000000..1daeeff6f --- /dev/null +++ b/tests/features193/Switch1.java @@ -0,0 +1,22 @@ +public class Switch1 { + public static void main(String[] argv) { + System.out.println(one(Color.R)); + System.out.println(one(Color.G)); + System.out.println(one(Color.B)); + System.out.println(one(Color.Y)); + } + + public static int one(Color color) { + int result = switch(color) { + case R -> 0; + case G -> 1; + case B -> 2; + default -> 3; + }; + return result; + } +} + +enum Color { + R, G, B, Y; +} \ No newline at end of file -- cgit v1.2.3