Tuesday, 14 February 2012

Differences between Abstract Class and Interfaces


Abstract class

Interface

A class can extend one abstract class

Abstract class contains abstract as well as non abstract methods

In this, multiple inheritance is not supported

Abstract class defines few or none of the methods.

Abstract classes should have sub classes

Any class can extend an abstract class

A interface can extend several interfaces

Interface contains only abstract methods

In this, multiple inheritance is supported.

Interface declares all the methods

Interface must implementation by classes.

Only an interface can extend another interface.

No comments:

Post a Comment