No, I do not agree that you would have a completely separate method. I am not sure why do you think so.Brian B wrote:The verbiage of the question says:
"...are correct for a method that overrides the following method:"
Isn't the answer "It can be abstract" a little misleading?
Considering, that an abstract method cannot have a method body, if you were to create an abstract class (as you'd be required to do if you declare a method abstract) wouldn't you have a completely separate method?
Not sure what you mean. Can you please provide some code to illustrate your point? Return type of a method has nothing to do with it being abstract or not.Wouldn't declaring it abstract violate the rule ("same return type in case of primitives (a subclass is allowed for classes, this is also known as covariant return types"). given in the explanation for overriding a method?
Sure, but the question is above overriding the original method. You can override it with an abstract method. I agree that it doesn't seem to natural but there is nothing wrong with it technically. Putting it another way, what would you call it if a subclass has the same method as its super class but has made it abstract. I think calling it overriding is ok.Based on your further explanation here:
"...You are right it is not actually overriding the method because there is no implementation. But look at it other way, the subclass is indeed giving a new behavior to this method and that is that the method has to be implemented by another subclass. This behavior is different from the original method (which does not force a subclass to override it) and in that sense it is overriding the original method."
If a subclass extends the abstract class, which you create to make the original method abstract, wouldn't the subclass be overriding the abstract method, not the original method presented in the question?
HTH,
Paul.