1Z0-804 · Question #47
Given the code fragment: What is the result when infected() is invoked?
The correct answer is D. before catch finally. The following line throws and exception: This exception is caught by: catch(Exception e) { System.out.print("catch "); Lastly, the finally statement is run as the finally block always executes when the try block exits. This ensuresthat the finally block is executed even if an…
Question
Given the code fragment:
What is the result when infected() is invoked?
Options
- Abefore try catch finally after
- Bbefore catch finally after
- Cbefore catch after
- Dbefore catch finally
- Ebefore catch
How the community answered
(26 responses)- B15% (4)
- C4% (1)
- D73% (19)
- E8% (2)
Explanation
The following line throws and exception: This exception is caught by: catch(Exception e) { System.out.print("catch "); Lastly, the finally statement is run as the finally block always executes when the try block exits. This ensuresthat the finally block is executed even if an unexpected exception occurs.
Topics
Community Discussion
No community discussion yet for this question.