A try block is executed before its finally block.
When the return statement is executed, the value to be returned is stored. When the finally block completes, that value is returned.
Note that a is not a value. a is a variable that stores a value. If you change a, you change a, you don't change the value that was stored for the return.
For the technical reason, we go to the Java Language Specification on the try-finally block
If execution of the try block completes abruptly for any other reason
R, then the finally block is executed, and then there is a choice:
If the finally block completes normally, then the try statement completes abruptly for reason R.
If the finally block completes abruptly for reason S, then the try statement completes abruptly for reason S (and reason R is discarded).
A return statement completes abruptly, so if a try with a finally has a return and the finally also has a return, the finally's return supersedes the try's.