I can\'t understand exactly how return works in try, catch.
try and finally without
Yes, it's confusing.
In Java, all program control paths of a non-void function must finish with a return, or throw an exception. That's the rule put nice and simply.
But, in an abomination, Java allows you to put an extra return in a finally block, which overrides any previously encountered return:
try {
return foo; // This is evaluated...
} finally {
return bar; // ...and so is this one, and the previous `return` is discarded
}