Inside Method A, there is method B. Method B throws exception, but method A compiled even it does not catch exception or throws exception, could it be possible?
Method B is something like as below:
MethodB() throws SomeException{
if(Some)
doneSomething
return
else if(some)
donesomethingElse
return
throw SomeException
}
If the
SomeExceptionextendsRuntimeException. Then you don’t need to catch it even if the signature looks like that.Also note that you can just remove the
throws SomeExceptionin that case. Read more here.