Describe the conditional statement in java that does not accept the Boolean datatype value in the conditional statement.
Answers
Switch is a conditional statement in Java that does not accept a boolean value in the conditional statement.
A switch case statement is multiple branching statement where a
particular statement is executed out of a number of options as per the
user's choice.
In this system, the control goes to a specific case and executes the
statements for the given switch value.
It also includes a 'default' case. The 'default' case is executed only when
the switch value doesn't match any of the given cases.
A switch statement starts opening curly bracket '{' and ends with
closing curly bracket '}' the cases which are enclosed within this
which statement are known as the switch block.
A break statement is used at the end of each case that is used as a
case terminator.
No statement is written after break in any specific case.
This statement forces the control to exit from the switch block.
If break statement is not used after case that control intersect the
other case for execution this condition is known as fall through.
This is a special case in switch case structure.
It is executed when the value does not match with any of the case.