1.package flowcontrol;
2.
3.public class SwitchCase {
4.
5. public static void testFirst(int i) {
6. switch (i) {
7. default:
8. ("default");
9. case 1:
10. ("one");
11. case 2:
12. ("two");
13. case 3:
14. ("there");
15. }
16. }
17.
18.
19. public static void testLast(int i) {
20. switch (i) {
21. case 1:
22. ("one");
23. case 2:
24. ("two");
25. case 3:
26. ("there");
27. default:
28. ("default");
29. }
30. }
31.
32.
33. public static void testMiddle(int i) {
34. switch (i) {
35. case 1:
36. ("one");
37. case 2:
38. ("two");
39. default:
40. ("default");
41. case 3:
42. ("there");
43.
44. }
45. }
46.
47. public static void main(String[] args) {
48.
49. testFirst(2);
50. ("------------------");
51. testFirst(9);
52.
53. ("|||||||||||||||||||||||||||||||||||");
54.
55.
56. testLast(2);
57. ("----------------");
58. testLast(9);
59.
60. ("|||||||||||||||||||||||||||||||||||");
61.
62. testMiddle(2);
63. ("----------------");
64. testMiddle(9);
65.
66. }
67.
68.}