Books Related to Java Technology

Sunday, December 28, 2008

Difference between an Abstract class and Interface?

Differences:

  • Interfaces provide a form of multiple inheritance. A class can extend only one other class.
  • Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.
  • A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.
  • Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.

Similarities:
  • Neither Abstract classes or Interface can be instantiated.
For more details you can visit: http://www.worldinfosoft.com

This is a one of the best tutorial site, where you can find lots of example with full description of code and you van also prepare of your interview from this site WORLDINFOSOFT.COM.

1 comment: