Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0b091c9 commit 0fe1d72Copy full SHA for 0fe1d72
ch05/Switch.java
@@ -0,0 +1,17 @@
1
+public class Switch
2
+{
3
+ public static void main(String[] args)
4
+ {
5
+ int month = 2, year = 2018, num = 31;
6
+
7
8
+ switch (month)
9
10
+ case 4 : case 6 : case 9 : case 11 : num = 30;break;
11
+ case 2 : num = ( year % 4 == 0 ) ? 29 : 28 ; break;
12
13
+ }
14
15
+ System.out.println( month + "/" + year + ":" + num + "days");
16
17
+}
ch05/SwitchExample.java
@@ -0,0 +1,20 @@
+public class SwitchExample
+ lastNamewinner("Smith");
+ private static void lastNamewinner(String name)
+ /* switch (name)
+ case "Smith":
+ case "Jones":
+ name = System.out.println("Congratulations, grand winner");
+ break;
+*/
18
19
20
0 commit comments