Hi,
Please check the following program, below program output is Exit 10, but i didnt get why it is like this? can you please explain?
I traced the the program upto print Exit, after Exit again case 10: is there to execute but swich case dont go back to case 10 i think. So default will execute na? I have a confusion can you please clarify. If no case match then only default case will execute, already case 10 executed previously, then why default case is executing please clarify.
public class SwitchProg1 {
public static void main(String[] args) {
int a=10;
switch(a++){
case 10:
switch(a--){
default:
System.out.print("Exit ");
case 10:
}
default:
System.out.println(a);
}
}
}
Thank you