1
2
3
4
5
6
7
8
9
10
11
12
13 package com.puppycrawl.tools.checkstyle.checks.descendanttoken;
14
15
16 class Example1 {
17 void testMethod1() {
18 int x = 1;
19 switch (x) {
20 case 1:
21 System.out.println("hi");
22 break;
23 default:
24 System.out.println("Default");
25 break;
26 }
27
28 int y = 1;
29 switch (y) {
30 case 1:
31 System.out.println("hi");
32 break;
33 }
34 }
35
36 void testMethod2() {
37 int x = 1;
38 switch (x) {
39 case 1:
40
41 break;
42 default:
43
44 break;
45 }
46
47 switch (x) {
48 case 1:
49
50 break;
51 case 2:
52
53 break;
54 default:
55
56 break;
57 }
58 }
59
60 void testMethod3() {
61 int x = 1;
62 int y = 2;
63 switch (x) {
64 case 1:
65 System.out.println("xyz");
66 break;
67 }
68 switch (y) {
69 case 1:
70 switch (y) {
71 case 2:
72 System.out.println("xyz");
73 break;
74 }
75 break;
76 }
77 }
78 }
79