Define fall through(in java). Give a simple example.
Answers
Answered by
7
Fall through. In a switch, control flow falls through to the next case. We must be careful to use breaks (or returns) to prevent incorrect behavior.Case
This example loops over the numbers 0, 1 and 2. The switch has no case for 0, so the default block is reached. For 1 the first case matches
This example loops over the numbers 0, 1 and 2. The switch has no case for 0, so the default block is reached. For 1 the first case matches
Similar questions