Inheritance


  1. If super class and subclass have same variable name, which keyword should be used to use super class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Super keyword is used to access hidden super class variable in subclass.


  1. Static members are not inherited to subclass.











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Static members are also inherited to subclasses.



  1. Which of the following is used for implementing inheritance through an interface?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: C

    Interface is implemented using implements keyword. A concrete class must implement all the methods of an interface, else it must be declared abstract.


  1. Which of the following is used for implementing inheritance through class?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    Class can be extended using extends keyword. One class can extend only one class. A final class cannot be extended.



  1. What would be the result if a class extends two interfaces and both have a method with same name and signature?











  1. View Hint View Answer Discuss in Forum

    NA

    Correct Option: D

    In case of such conflict, compiler will not be able to link a method call due to ambiguity. It will throw compile time error.