Inheritance in Java
Inheritance in Java - Important Points
21. | Which keyword is used to implement method overloading in Java? |
---|
A. override
B. final
C. abstract
D. none of the above
View Answer Discuss Work SpaceAnswer: option d
Explanation:
22. | Which keyword is used to prevent a class from being inherited in Java? |
---|
A. final
B. static
C. abstract
D. private
View Answer Discuss Work SpaceAnswer: option a
Explanation:
23. | What is the output of the following program? class A { |
---|
A. 30
B. 20
C. 10
D. Compilation error
View Answer Discuss Work SpaceAnswer: option a
Explanation:
24. | Which of the following statements is true regarding inheritance in Java? |
---|
A. A class can inherit from multiple classes in Java.
B. A subclass can access private members of its superclass.
C. Constructors are not inherited in Java.
D. Inheritance is not supported in Java.
View Answer Discuss Work SpaceAnswer: option c
Explanation:
25. | Which keyword is used to implement an abstract method in a subclass in Java? |
---|
A. abstract
B. final
C. static
D. override
View Answer Discuss Work SpaceAnswer: option d
Explanation: