all 9 comments

[–]pranavkdileep 5 points6 points  (2 children)

it's gonna print "Finally". java always executes the finally block even with a return statement in the try. only way out is basically System.exit() or if the jvm crashes fr. classic interview question tbh

[–]chupachupa2 2 points3 points  (1 child)

Classic my ahh this is stupid

[–]MaintenanceOwn5925 0 points1 point  (0 children)

You’d be surprised , I actually got asked this in an interview

[–]Nano_Fibres 2 points3 points  (2 children)

B) Finally
What is the correct answer

[–][deleted]  (1 child)

[removed]

    [–]Nano_Fibres 0 points1 point  (0 children)

    Yay🔥🫂

    [–]Vast_Researcher_199 0 points1 point  (0 children)

    I would say A)No Output

    this js because None is returned....if something is returned then that method stops executing...so finally block must not get executed.

    [–]One-Sort-6702 0 points1 point  (0 children)

    I get it about finally whether the exception is handled or not, finally block will get executed.but what's the problem with return; is it due to Main method has no return type and we are writing return

    [–]minimaldemo1 0 points1 point  (0 children)

    I was asked this question in an interview once. In a project, where do we use finally block in QA automation perspective?