Return statement in a finally block

Question:
Can I put a return statement in a finally block?

Answer:
If there is a return statement within the finally block, it will trump any other return from the regular block.

Code:
public class FinallyReturn {
 
  public static void main(String[] args) {
    System.out.println(method());
  }
 
  public static String method() {
    try {
      return "returned by try";
    } finally {
      return "returned by finally";
    }
  }
 
}
 

Output:
$ java FinallyReturn 
returned by finally