Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Why Interfaces in java?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Ranch Hand
Posts: 215
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Report post to moderator
Hello Lakshmi,

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

Regards,
John Eipe
 
Dinner will be steamed monkey heads with a side of tiny ads.
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
    Bookmark Topic Watch Topic
  • New Topic