Logo 
Search:

Java Answers

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds
  Question Asked By: Seth Ford   on Mar 29 In Java Category.

  
Question Answered By: Maurice Hanson   on Mar 29

Any class  can only extend one other class but it can implement  many interfaces.
Interfaces can have no implementation code whereas abstract  classes can
implement some methods while leaving others abstract. As to when you implement
either one of them, it depends largely on what you are doing. Interfaces are
useful as contracts (i.e. for plugins), callbacks, etc. Abstract classes are
useful for providing partial base implementations (shared functionality) while
still providing for extension. Often you may want to provide an interface  and
then an abstract base class which implements some of that interfaces standard
functionality.

Share: