Forum

Number Of Page View:100,000+/Months
LOGIN |New User

Reply

The Default Case
If we would like to to no changes is there . we can see the default case ,w hich is the keyword whose use fr the completely diff purpose.
The
only change we need to make is to add the default case to the preceding code:
int x = someNumberBetweenOneAndTen;
switch (x) {
case 2:
case 4:
case 6:
case 8:
case 10: {
System.out.println("x is an even number");
break;
}
default: System.out.println("x is an odd number");
}
Posted By: Name:Rajesh Kr URL: The Default Case