I have a basic question in Java:
I have two methods: functionA & functionB. functionA calls functionB, and functionB rise an exception. The call to functionB is in try scope of functionA.
Now I also want that functionA will go to it catch scope.
There is any way to do that?
If an exception is thrown in
methodBand you catch it, one way to propagate it tomethodAis to rethrow it:But if you need that, you probably should not catch the exception in
methodBat all and just let it propagate automatically tomethodA: