Yes, finally block will be executed and it won't depend on any function or so.
Try to execute this code in your compiler:
public static void main(String args)
public static int test()
Hence it's proved from the example above.
The cases where finally won't work are:
- If JVM crashes first
- If System.exit() is invoked