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" .
Which of the following is a non-scheduled bank?
Which of the following statements accurately describes the relationship between price and quantity demanded/supplied, considering potential exceptions?
Which of the following types of risks are not covered in BASEL II/III
Under the revised framework for Commercial Papers (CPs), what is the requirement for settlement of primary issuance of CPs in terms of time?
What is the name of the index that measures the performance of small-cap companies in the Indian stock market?
The maximum number of directorships that a person can have in a public company are ____ and in Private company are ___.
As per the Companies Act the conditions under which a person is ineligible for appointment as a director of a company ____________
Which of the following is not a major gold trading center?
What does R stand for in CRILC?
Accounting Standards do not permit following method of inventory valuation: