Page 823 - AP Computer Science A, 7th edition
P. 823

21. (A) This is a question about the scope of variables. The scope of the count variable that is declared in main() extends up to the closing brace of main(). In doSomething(), count is a local variable. After the method call in the for loop, the local variable count goes out of scope, and the value that’s being printed is the value of the count in main(), which is unchanged from 0.


































































































   821   822   823   824   825