Latest Entries »
After struggling with understanding how to use interfaces in Java for a while, I finally found the best description on how to use them. I’m not surprised this information was written back in 1998. Here’s some excerpts from the article that pretty much sums up the reason for interfaces …..
“In Java, interfaces solve all these ambiguities caused by the diamond problem (see article). Through interfaces, Java allows multiple inheritance of interface but not of implementation. Implementation, which includes instance variables and method implementations, is always singly inherited. As a result, confusion will never arise in Java over which inherited instance variable or method implementation to use.”
“Java’s interface gives you more polymorphism than you can get with singly inherited families of classes, without the “burden” of multiple inheritance of implementation.”