Inheritance in Java
Inheritance in Java - Important Points
31. | Which keyword is used to implement method overriding in Java? |
---|
A. override
B. final
C. abstract
D. none of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
32. | Which of the following is not a superclass of the String class in Java? |
---|
A. Object
B. CharSequence
C. Number
D. Comparable
View Answer Discuss Work SpaceAnswer: option c
Explanation:
33. | What is the purpose of the 'super' keyword in Java? |
---|
A. To call a method or constructor of a superclass
B. To declare a superclass
C. To access a private field of a superclass
D. To override a method of a superclass
View Answer Discuss Work SpaceAnswer: option a
Explanation:
34. | Which of the following statements is true regarding the 'this' keyword in Java? |
---|
A. It can be used to access a static field of a class.
B. It can be used to call a method of a superclass.
C. It can be used to refer to the current instance of a class.
D. It can be used to declare a constructor.
View Answer Discuss Work SpaceAnswer: option c
Explanation:
35. | What is the output of the following program? class A { |
---|
A. Class A, Class B
B. Class B, Class A
C. Class A
D. Class B
View Answer Discuss Work SpaceAnswer: option a
Explanation: