Actually, the only real differences I see between abstract classes and interfaces are A) you have to implement an interface, where as an abstract class is extended and B) an abstract class can contain methods with implementations, where as an interface can not and C) you can only extend one class, but you can implement any number of interfaces. While interfaces are
Java's answer to multiple inheritance, it does not function quite the same way.
I can have the following code:
And I'll get "Foo!" printed out. I get the exact same response if I have this code:
The two abstract and interface classes act the same way here. However, I could add another method to the abstract Foo class, and give it an implementation, but could not do the same to the interface Foo, the compiler would give an error. Preferably, I would use the interface version over the abstract, since you only get to extend one class. The only time you would want to use abstract (correct me if I am wrong here) classes is if that class also needed some of its own implementation, or just to make the design make sense (an abstract Animal class probably wouldn't be a logical interface).
Hope that helps
Jason
[This message has been edited by jason adam (edited November 01, 2001).]