I'm new to Java and I'm trying to learn the concept of "Overriding method" as part of inheritance.
If an instance method in the subclass has the same signature(i.e. name plus the number and the type of its parameters) as the method in the superclass but it has a DIFFERENT return type, does the instance method still override the method in the superclass? Or is it a completely new method?
No when you have DIFFERENT return type, that is completely a new method. Not overridden.
Return type is also part of method signature. You need to obey all the rules to override.
And interesting part to note here is Covariance
Consider you have Parent and Child relationship and trying to override the methods of Parent in Child, Co-variance means that the overriding method returning a more specific type. Below example shows you the same, Parent method returning Object and where as the Child method decided to return a specific type (String) where String is child of Object class. Hence covariance existed here.
Covariant return types :
public class Parent{
public Object doSomething(){}
}
public class Child extends Parent{
public String doSomething() {}
}
If you are interested give a read on my blog post : http://codeinventions.blogspot.in/2014/11/covariant-contravariant-and-class-invariant-example-and-difference-in-java.html