The Switch Statement in Java
The switch statement syntax is also the same as the C++. It’s general syntax is:
switch(variable){
case value1:
Statements;
break;
case value2:
Statements;
break;
default:
Statements;
break;
}
Where:
variable = is the variable you want to switch
value1, value2 = is a Boolean value. It can’t be a target of conditions. It must be a numeral value not a character nor a string.
No Response to "Java Tutorial #10"
Post a Comment