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 am new this forum and new to Java. In this forum, many explained the difference between the abstract and interfaces. Does any one knows, what is the driver behind these two architecture which looks pretty similar. I mean, Why interfaces ? What is that we can't achieve by having abstract class, we needed interface vice versa ?
Expanding a bit more: The C++ language allowed a more powerful form of multiple inheritance, and the Java language designers felt that this caused problems more often than it solved them. They felt that multiple inheritance of method declarations was a good thing, but multiple inheritance of method implementations was bad. So you can inherit as many declarations as you want, if they're defined in interfaces - but you can only directly inherit from one class. This inherited class may be an abstract class if there's at least some implementation which you wish to inherit, but if it doesn't make sense to provide a complete implementation (usually because you need the flexibility to implement some things differently in different classes, and there's no single "default behavior" for every method that makes sense to put in a base class). Definitely check out the JavaWorld article Eric cited for more info. [ December 31, 2002: Message edited by: Jim Yingst ]