It overrides any return statement from try or catch.
When a return statement is used in the finally block, it overrides any previous return statement from try or catch blocks, potentially hiding exceptions or return values. This can lead to unexpected behavior, as the finally block is designed to execute after try and catch. For example, if a method logs a transaction result in try and returns it, but finally also returns a value, the transaction log might be ignored.
Additional Notes
How does a return statement in the finally block affect exception handling?