Test Switch problem in java..
class TestSwitch
{
public statitc void main(String args[])
{
int i=1,j=0;
switch(i)
{
case 2: j+=2;
case 3: j+=4;
default: j+=0;
case 0: j+=2;
}
System.out.println("The Value of J="+j);
}
}
The out is 2
bexoz default is used anywhere in switch...
class TestSwitch
{
public statitc void main(String args[])
{
int i=1,j=0;
switch(i)
{
case 2: j+=2;
case 3: j+=4;
default: j+=0;
case 0: j+=2;
}
System.out.println("The Value of J="+j);
}
}
The out is 2
bexoz default is used anywhere in switch...
No comments:
Post a Comment