If try It's carried out inside return, Will it still be implemented finally?

preface

        We all know that ,finally In an operation that catches an exception , It's always the last and will be carried out . that , If I'm using try finally When , If try
Gave one return, Will it still be implemented finally What about ? Here's a try

finally

       Finally Code is executed with or without an exception .

        When there are no exceptions , stay try After the end of code execution in , implement finally.

        If an exception occurs and gives catch capture , At the end of the execution catch After that finally.

        If there is an exception and it is not caught , Before the exception is thrown to the upper level .

        in fact , no need try catch It can also be executed directly try finally. So if I'm here try inside use return What will happen ?

The code is as follows
public class Test { public static void main(String[] args) { int result = fun()
; System.out.println("result = " + result); } public static int fun(){ int ret =
0; try{ return ret; }finally { ret = 5; System.out.println("ret = " + ret); } }
}

        The result of the test is ,finally The code inside will still be executed . however , Although ret Assigned a value 5. But the returned value is still 0. therefore , Even in try It's used in it return, And it will still be implemented finally. however finally It can't be changed return Value of .

        Because in the process of implementation ,
try Execute to return, I'll take it first ret The value of is stored in a temporary variable , wait until finally It will not return until the execution is completed . therefore finally The final return result cannot be changed

        that , If I were finally It also carries out one return What about ? What will happen ?

The code is as follows
public class Test { public static void main(String[] args) { int result = fun()
; System.out.println("result = " + result); } public static int fun(){ int ret =
0; try{ return ret; }finally { ret = 5; return ret; } } }
        This is the time try Inside return It will be lost . It's just execution finally Inside return

Technology