posted 15 years ago
I think you've understood it right. If the return type of the overriding method was Integer (or a sub-class as per covariant return types, but Integer class is final so not applicable here) then the code would've compiled fine. The answer in whizlabs also says the same thing, but they also explain that if the print method in sub-class had different arguments, then there would've been overloading and thus the code would've compiled fine...