Interfaces instead of multiple inheritance?
843789Jul 10 2009 — edited Jul 11 2009I've read that "The Java programming language does not permit multiple inheritance , but interfaces provide an alternative."
But I also read contradictory information-There are no method bodies in an interface.
Java interfaces only contain empty methods? Apparently, if I want to share a method among classes, I have to re-write the methods in each class that implements the interface. That doesn't seem at all like multiple inheritance. Am I missing something?
It seems that I will have to cut and paste the implementation code from one class to another, and if I change the methods, I have to cut and paste it all over again.
I've read that interfaces save a lot of time re-writing methods, but how?
Does this really provide the same capabilities as multiple inheritance, or am I missing something?
Thanks,
Pat