Java Reference
In-Depth Information
Statement
Break;
Case value 2:
Statement
Break;
.
.
.
Case vale n:
Statement
Break;
Default:
Statement;
}
The functioning of the switch statement is compares the given value with all the cases and
when the match found the program sequence is executed.
For example
Class sampswitch {
Public static void main (string args [])
{
Switch (i)
{
Case0:
System.out.println (“i is zero.”);
Break;
Case1:
System.out.println(“i is one.”)
Search WWH ::




Custom Search