Oracle Certified Associate Java Se 8 Programmer · Free Practice Question Medium
Question 7
Which of the following are valid in overriding ?
-
A
If the parent class method throws any checked exception then child class method should throw the same checked exception or its child.
-
B
Return types should be co-varient.
-
C
If the parent class method throws any checked exception then child class method should throw the same checked exception or its parent.
-
D
The access specifier of the child class method should be either same or broader than parent class method.
Reveal correct answers
Correct answers: A, B, D
Explanation
Return types should be co-varient.The access specifier of the child class method should be either same or broader than parent class method.
If the parent class method throws any checked exception then child class method should throw the same checked exception or its child.
Discussion
Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.
You must be logged in to post a comment.
