Question
Consider a Shape class with a method draw(), and Circle
and Rectangle classes that inherit from Shape and override draw(). If you have a List containing Circle and Rectangle objects, calling draw() on each element demonstrates:Solution
This is a classic example of runtime polymorphism. Even though the list holds references of type Shape, when draw() is called, the specific draw() method of the actual object (either Circle or Rectangle) is executed. The same method call (draw()) behaves differently based on the object's type.
Which of the following is a correct reading regarding the Eighth Schedule of the Constitution and its additions?
Which of the following constitutional body in India is responsible for the conduct of elections?
Under what conditions can a beneficial owner create a pledge or hypothecation on securities owned through a depository as per the Depositories Act?
The examination of a witness by the Adverse Party shall be called his_______.
Which of the following statements is true regarding confession made to a police officer under the Bharatiya Sakshya Adhiniyam, 2023?
If a Money Bill was passed to Rajya sabha for recommendations and has not been returned with or without recommendations in _______ days it shall be deem...
According to the Occupational Safety, Health and Working Conditions Code, 2020 the _______________ be responsible for making financial and other provisi...
Which authority has the power to attach property believed to be involved in money laundering under the PMLA, 2002?
Where any authority or Committee contravenes any provision of The Scheduled Tribes and Other Traditional Forest Dwellers (Recognition of Forest Rights) ...
Section 17A of the PC Act requires prior approval for: