Bookmark Topic Watch Topic
  • New Topic

Why Interfaces in java?  RSS feed

 
lakshmi raghavan
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello,

Could you please clarify if Interfaces in java were a design decision aiming to improve just the development process - I can understand it does help a lot to set out your classes' signatures before moving to teh concrete implementation?
Why is it that java allows multiple inheritance of forms
class Derived implements BaseInterace extends BaseClass?
I get a compiler error complaining of ambiguous variables when the same variable (say int a) is in BaseInterface (as a constant) and in the BaseClass (as an instance variable). This means that the interfaces dont really gaurd against diamond death in any special way. Cant they just use the same trick for inheriting from multiple classes too?

What was the main reason that lead to the concept of java interfaces?

Thanks,
Lakshmi
 
John Eipe
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hello Lakshmi,

Welcome to Java Ranch!
Have a look at:
http://www.coderanch.com/t/459357/Beginning-Java/java/Interfaces-java

Regards,
John Eipe
 
It is sorta covered in the JavaRanch Style Guide.
    Bookmark Topic Watch Topic
  • New Topic
Boost this thread!