Start learning 50% faster. Sign in now
This program demonstrates runtime polymorphism in Java through method overriding. When the method display() is called on the object obj, the overridden method in class B is executed. This is because obj is instantiated as new B(), and at runtime, the JVM determines the appropriate method to execute based on the actual type of the object. Thus, even though obj is declared as type A, the overridden display() method in B is executed, producing the output "Class B" . This behavior is a key feature of Java's dynamic method dispatch mechanism. Explanation of Incorrect Options: A) Class A : This would be true if the display() method in class B was not overridden. However, since B overrides A's method, this option is incorrect. C) Compilation Error : The code is syntactically correct, so it compiles without any issues. D) Runtime Error : The program runs successfully, as all method calls are valid and properly resolved at runtime. E) None of the above : This is incorrect, as the correct output is explicitly "Class B" .
A paper is folded and cut as shown below. How will it appear when unfolded?
Select the option that represents the letters that, when placed from left to right in the following blanks, will complete the letter-series.
F I ...
If ‘-‘ means ‘÷’, ‘×’ means ‘+’, ‘÷’ means ‘×’ and ‘+‘ means ‘-‘ what will be the value of the following expression?...
In a certain code language, ‘CRUSADE’ is written as ‘ETTUZFD’ and 'MUSICAL' is written as ‘OTUHEZN’. How will ‘AUGUST’ be written in tha...
If you are the 27th person in a queue from one end and 38th from the other end, what is the total number of persons in the queue?
Select the correct mirror image of the given figure when the mirror is placed at MN as shown.
Select the figure that will come next in the following figure series.
Select the number from the options that can replace the question mark (?) and complete the given series
0, 7, 26, 63, 124,?
Which of the following numbers will replace the question mark (?) in the given series?
15, 27, 12, ?, 9, 33
Three statements are given, followed by three conclusions numbered I, II and III.
Assuming the statements to be true, even if they seem to be at ...