Given:
and the code fragment:
What is the result?
Given:
and the code fragment:
What is the result?
The given code will first check if the string 'param1' equals 'oracle' ignoring case sensitivity. Since 'param1' is set to 'Oracle', this evaluation will be true. Hence, it will throw an instance of 'ExSub' with error code 9001, message 'APPLICATION ERROR-9001', and a cause of new FileNotFoundException('MyFile.txt'). The 'catch' block catches this exception and calls 'getMessage' on it. This method constructs the error message based on 'eCode', 'super.getMessage()', and 'this.getCause().getMessage()'. The resulting output will be '9001: APPLICATION ERROR-9001-MyFile.txt'.
C: 9001: APPLICATION ERROR-9001-MyFile.txt
Tested: C.
Answer: C
public class ExSub extends ExSuper{ Compilation actually fails on this line,you can't have 2 public classes in the same file... However,if we neglect this,I think C would be the correct answer.
C is correct because If block will be called and message will print.
The correct answer is C
A correct