Junior — Middle
What happens to the return value if in a try block you specify a number with return, and there is your own code in the finally block?
sobes.tech AI
Answer from AI
In Java, if a try block contains a return statement and a finally block executes code, the return value is determined by whether the finally block also has a return statement. If it does, that value overrides the try's return. An example illustrates this behavior.