1. parameter type
Basic data types:
(Integer): byte, short, int
(Characters): char
Non-basic data types: String and enumerated classes
2. break with matters relating to:
Source:
for(int x=0;x<5;x++) {
switch(x) {
case 1:
System.out.println(1);
case 2:
System.out.println(2);
case 3:
System.out.println(3);
case 4:
System.out.println(4);
}
}
System.out.println("break");
for (int x = 0; x < 5; x++) {
switch (x) {
case 1:
System.out.println(1);
break;
case 2:
System.out.println(2);
break;
case 3:
System.out.println(3);
break;
case 4:
System.out.println(4);
break;
}
}
From the point of view on the printout:
1
2
3
4
2
3
4
3
4
4
break
1
2
3
4
Do not break, does not complain, but except for the first qualifying case have to determine the function, the back of the case did not determine the function, print out later in the code line by line