What is the output of the following code snippet?
3: do { 4: int y = 1; 5: System.out.print(y++ + " "); 6: } while(y <= 10);
D.
The variable y is declared within the body of the do-while statement, so it is out of scope on line 6.
Line 6 generates a compiler error, so option D is the correct answer.