____________ can be achieved through inheritance.Select one:a.code reusabilityb.run time polymorphismc.both run time polymorphism & code reusabilityd.none of the options
Question
____________ can be achieved through inheritance.Select one:a.code reusabilityb.run time polymorphismc.both run time polymorphism & code reusabilityd.none of the options
Solution
The answer is c. Both run time polymorphism and code reusability can be achieved through inheritance.
Inheritance allows a class to be defined that has a certain set of characteristics (such as methods and variables) and then other classes to be created which are derived from that class. The derived class inherits all the capabilities of the superclass, and can add embellishments and refinements of its own. This leads to code reusability.
Run time polymorphism is a process in which a call to an overridden method is resolved at runtime, rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass. The determination of the method to be called is based on the object being referred to by the reference variable. This can also be achieved through inheritance.
Similar Questions
Polymorphism types in Java is/areOptionsRun timeCompile timeBoth Compile time and Run timeNone of the mentioned
Which of the following is used to achieve runtime polymorphism in java.Question 13Answera.Operator Overloadingb.Method Overloadingc.Encapsulationd.Method Overriding
Which of the following is a type of polymorphism in Java?Select one:Compile time polymorphismMultiple polymorphismExecution time polymorphismMultilevel polymorphism
5. Which feature of OOP indicates code reusability?a) Abstractionb) Polymorphismc) Encapsulationd) Inheritance
answerWhich of these allows compile-time polymorphism?OptionsMethod overloadingMethod overridingBothNone of the above
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.