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.
I have a doubt regarding interfaces. An abstract class with all the methods declared abstract is same as an interface. i.e; the concrete class which extends the abstract class or the one implementing the interface should define all the methods. This is fine. So Is the only advantage of interfaces is Multiple inheritance ? Or is there any other ? Can anyone explain.
Interfaces allow you to define common behavior among otherwise very different objects; like sailboats and ducks.
A sailboat object could be a subclass of Boat, and a duck could be a subclass of Bird. Even though they are completely different objects, they have some common traits.
They can both float and they both have the means to move in the water; one with sails and the other with webbed feet. So even though they are radically different objects, a method that operates on a Floatable, can expect that it will float and has a propel method.