for(int i=5; i>=2; i--)
{
switch(i)
{
case 1: case 3:
System.out.println("YES"); break;
case 2: case 4: case 5: System.out.println("NO");
}
}
System.out.println("OK");
}
ok so i know this outputs :-
but in this book im reading, when it come's to the value 3, where case 3 is executed doesn't the break statement break outside this loop? than proceeding to the next value 2. Im kind of confused, why does it continue with the loop when at case 3 it has the break statement, shouldn't go out and continue with whatever code is below?