Short answer that I've come to accept:
Firstly, it helps with readability, being able to see which is the superclass apart from interfaces. Secondly, though 'extends' and 'implements' do the same thing of inheriting from a Type and could be expressed in a single keyword, the different words help to express the different idea behind the inheritance. We can see this idea is also expressed in how Interfaces 'extend' other Interfaces rather than 'implement' them.
Thanks for your insight, I think I've learned some good principles from these answers.
Full question:
This is not a question about why Java avoids multiple inheritance. This is also not about the definition of Interfaces and Abstract Classes nor necessarily their conceptual differences, I think most of us understand those principles well enough.
This is just about how these types are inherited
The reason I ask is because sometimes (during the live design phase of projects) I find myself changing an Interface to an Abstract Class, or vice versa, then having to go through all its children to switch between 'extends' and 'implements'. Sure, I could probably plan it out better but this situation just got me thinking if it was all really necessary. If it was a single keyword this would be handled purely by the compiler.
I don't see the need for this distinction between 'extends' and 'implements'; However, I'm not a language designer.. So is there some good reason that I may have overlooked?
I note that Generics actually does throw out this distinction, only using 'extends' for both types. Also, Interfaces can "extend" a list of other Interfaces further blurring the line between 'extends' and 'implements' in my opinion.
Here's an example of what we have vs. what I think I want:
public interface MyInterface extends OtherInterface1, OtherInterface2 {
public void myInterfaceMethod();
}
public class MySuperclass {
public void mySuperclassMethod(){ ... }
}
// What we have - If I change MySuperclass to an Interface then this breaks
public class MyClass extends MySuperclass implements MyInterface {
@Override public void myInterfaceMethod() { ... }
}
// What I want - If I change MySuperclass to an Interface then this is still fine
public class MyClass extends MySuperclass, MyInterface {
@Override public void myInterfaceMethod() { ... }
}
Thanks