Search This Blog

If you have any problem or question please write in the comments. We will try to solve and send you the solution. Not just that we will also post your problems solution on our blog.

Sunday, 26 June 2011

Java program using nested switch


import java.util.*;
class nswitch
{
public static void main (String arg[])
{
Scanner in = new Scanner (System.in);
int a,b;
a=3;
b=2;
switch (a)
{
case 1:
switch (b)
{
case 1:
System.out.println ("\n\t Inner One ");
break;
case 2:
System.out.println ("\n\t Inner Two ");
default:
System.out.println ("\n\t Inner :: Invalid ");
}
case 2:
System.out.println ("\n\t Outer Two ");
break;
case 3:
System.out.println ("\n\t Outer Three ");
break;
default:
System.out.println ("\n\t Outer :: Invalid ");
}

}
}

1 comment: