Here's one that is driving me crazy... how would I have gone about finding the answer in a reasonable amount of time?
1. class Question {
2. public static void main(
String[] args) {
3. for(int i = 0; i < 10; ++i) {
4. try {
5. if(i % 3 == 0) throw new Exception("E0");
6. try {
7. if(i % 3 == 1) throw new Exception("E1");
8. System.out.println(i);
9. }catch(Exception inner) {
10. i *= 2;
11. }finally {
12. ++i;
13. }
14. }catch(Exception outer) {
15. i +=3;
16. }finally {
17. ++i;
18. }
19. }
20. }
Which lines of output are displayed by the program above (select all that apply)?
A. 4
B. 5
C. 6
D. 7
E. 8
F. 9
Thank you,
Barbara
(The mock
test gives the answer as B & E.)
[This message has been edited by Barbara Dyer-Bennet (edited September 14, 2000).]