Q45
What will be the output? class MyClass public String test() try System.out.print("One"); return ""; finally System.out.print("Two"); public class Test public static void main(String args[]) MyClass m = new MyClass(); m.test();
A.
One
B.
Two
C.
One Two
AnswerD.
Compilation Error
E.
None of these
Answer: Option C
Solution
Answer: Option C
Solution:
Finally block will execute irrespective of return statement in try block.