Hi all,
look at the following 2 examples...
Example 1
What is the result of attempting to compile and run the program?
a. Prints: 0,1,0,0
b. Prints: 1,1,0,1
c. Prints: 0,1,0,1
d. Prints: 0,1,1,1
e. Prints: 1,1,1,1
f. Compile-time error
g. Run-time error
h. None of the above
Answer is ---
f Compile-time error A compile-time error is generated, because the second catch clause attempts to catch an exception that is never thrown in the try block.
Example 2
What is the result of attempting to compile and run the program?
a. Prints: 0,1,0,0
b. Prints: 1,1,0,0
c. Prints: 0,1,1,0
d. Prints: 1,1,1,0
e. Prints: 1,1,1,1
f. Compile-time error
g. Run-time error
h. None of the above
Answer is ---
c Prints: 0,1,1,0
Why does the compiler not complain about the WhiteException that is not thrown as it complains in example 1 for BlueException??
Am i missing something ??
thanks,
[ Jess adjusted where the [code] tags end so that word wrapping doesn't get all screwed up with the text ]
[ January 31, 2004: Message edited by: Jessica Sant ]