Anjali,
When you want to ask for help on a question from my web site, then you can post the question here as long as you say that the question came from my web site. When I see one of my questions with the name of the class changed, then it causes me to suspect that you found that question on a web site that has plagiarized my work. In the future, please don't change the name of the class and please specify that the question came from my web site. It would also be nice to provide the URL to the page where the question can be found.
In this case, if that question did not come from my web site, then please tell me where it came from.
The explanation for that question is as follows.
On the first pass through the loop, the switch expression, x, has the value, -5. None of the case constants are matched, so the statement following the default label is executed causing the value of x to be set to -3. On the second pass, the default case of the switch statement is executed again, and two is again added to the value of x. The new value is -1. On the third pass, the value of x is again incremented, and the new value is +1. After that, the value of x is printed on each pass through the loop. For the last two passes, the value of x is 3.
[ August 09, 2004: Message edited by: Dan Chisholm ]