java case

The java case is used with a switch statement the switch statement is another conditional structure. The switch statement is used when we have many choices and we should need only one to be executed we called java case. Nested if it becomes very difficult in such a situation. The switch statement is used when we need to execute multiple cases with multiple conditions. In the switch, case it contains a different block of code and in which is only one executed when the switch value match with a case.

Syntax of java case

switch (variable or an integer expression)
{
     case constant:
     //Java code block;
     case constant:
     //Java code block;
     case constant:
     //Java code block;
     default:
     //Java code;
}
Read More

Comments