What will be the output of the program?
Correct Answer : A
In the program, the code
Tree tree = new Oak(); calls the constructor of
tree is also instance of
Oak extends from
Tree. So first
else if is executed printing Output is Tree.
Hence the answer is A.