Given the following class definitions, which statement is true?
public class Animal {
public Number getAge() throws Exception {
return 10;
}
}
public class Dog extends Animal {
// INSERT METHOD HERE
}
-
A
Overriding the method with `public Integer getAge() throws Exception` is a valid covariant return.
-
B
Overriding the method with `public Number getAge()` is invalid because a checked exception is removed.
-
C
Overriding the method with `public Object getAge() throws Exception` is a valid override.
-
D
Overriding the method with `public Integer getAge() throws RuntimeException` is invalid because the return type is changed.