Polymorphism in Java
Polymorphism in Java - Important Points
11. | Which of the following is an example of method overloading? |
---|
A. void print(int a, int b)
B. int print(int a, int b)
C. void print(String s)
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation:
12. | Which of the following is an example of method overriding? |
---|
A. void print(int a, int b)
B. int print(int a, int b)
C. void print(String s)
D. void print()
View Answer Discuss Work SpaceAnswer: option c
Explanation:
13. | Which of the following is an example of the final keyword in Java? |
---|
A. final int a;
B. final void print();
C. final class Animal {}
D. All of the above
View Answer Discuss Work SpaceAnswer: option d
Explanation:
14. | Which of the following is not an advantage of polymorphism? |
---|
A. Code reuse
B. Flexibility
C. Encapsulation
D. Simplicity
View Answer Discuss Work SpaceAnswer: option c
Explanation:
15. | Which of the following is true about the instanceof operator? |
---|
A. It is used to check if an object is an instance of a specific class or interface
B. It can be used with primitive data types
C. It can be used to compare two objects for equality
D. None of the above
View Answer Discuss Work SpaceAnswer: option a
Explanation: