In the latest stable release of Java and Eclipse (Kempler), entering the following code and executing it, assuming the package and class names exist:
package
If a condition in a case block is true and there is no return or break, all the other case blocks will be executed regardless if the are true or not.
For a rule of thumb always put a break or return at the end of a case block and you will be 90% right.
switch (p) {
case (1):
x--;
break;
case (2):
x = 2;
break;
case (3):
x = 3;
break;
default:
x++;
break;
}