Java Reference
In-Depth Information
Break;
Default:
System.out.println (“i is greater than 4.”)
}
Output
i is zero.
i is one.
i is greater than 4.
i is greater than 4.
Example of nested switch loop program
Switch (countfigures)
{
Case 1:
Switch (targetvalue)
{//nested switch//
Case 0:
System.out.println (“target is zero”;
Break;
Case 1:
System.out.println (“target is one”;
Break;
}
Break;
Case 2: //...
Important features of switch statement are.
Switch statement can only check for equality unlike if.
There cannot be two cases constant in the same switch with identical values.
Search WWH ::




Custom Search