This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Multiple inheritance can be done - it's there in other languages. The inventors of Java looked at those other languages and decided it brings along too much complexity for the developer and the compiler and JVM implementors. They started Java with the goal of being small and simple, not the world's ultimate OO langauge, so compromises like that make sense and we just live with them. I'm fine with the choice - single inheritance is hard enough to get right!
Any variable access on the same object or class will be fast enough to not worry about - local, static, member. I would absolutely go for human understanding in my code before any optimization of that kinda thing. Indexed arrays are probably very fast, too. The access algorithm is dead simple.
Other collections and such do have some speed differences in various operations. My Collections Crib Sheet has some hints on how to select which collection to use. BTW: I'm aware the crib sheet is missing some perfectly fine collection classes. Send me any suggestions for improvements via mail from the site. Thanks!! [ September 25, 2004: Message edited by: Stan James ]
A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
The real killer in multiple inheritance is when methods with the same name and signature are inherited from two different parents. The rules for deciding which one to call on a child object are complicated.
Then there is diamond inheritance, where Method() in class A is inherited by two child classes B and BB, then class C inherits from B and BB. Does it matter which side Method() comes down from? Then suppose that Method() is overridden in class B but not in class BB. How is super.Method() interpreted?
The advantage of multiple implementation is that the obligation to provide a method can be inherited many times but the implementation will only be provided or inherited once. No ambiguities.