posted 24 years ago
Answer for ur Q1. lies in your Q2.
Checked exceptions declared as throws XX in a method declaration should be exactly thrown by the body of the method. You can't just say, i will come to London and be without going to London. Like that, if you didn't throw the checked exception in the body, compiler will fire at you. well thats not the problem u asked for!!. Here, u r throwing AException, but throwing BException in the finally bloc. This makes the previous unhandled Exceptions to just go escape and the method overall throws BException (which is not handled in the finally bloc) from its body. So declaring throws BException worked.
Now coming to second Q. if u commented that throws BException statement in the finally bloc, and declaring that u r throwing BException, it is similar that u say somebody u will come to Frankfurt and they are waiting there to receive u and u go to London and nobody is there to receive u. Similarly u throw AException (a checked one), but declare thrwos BException.
HTH.
Sun Certified Programmer for Java 2 Platform