Sponsored Link •
|
Advertisement
|
Advertisement
|
This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.
Message:
Neither can be instantiated. An interface has all public members and no implementation. An abstract class is a class which may have the usual flavors of class members (private, protected, etc.), but has some abstract methods. Use interface as much as possible and only use an abstract class in the case where you want to provide some (but not all, of course) implementation. In practice, you want to prefer using, passing and returning interfaces, not abstract class references. I think even in the case where you have an abstract class to share some implementation, you still want to have an interface represent what will be used by the client (for an example look at the new Collections -- you often pass around Collection, List, Set or Map references, but not a AbstractList, AbstractSet or AbstractMap, references). - mfg
Replies: |
Sponsored Links
|