difference between an Interface and an Abstract class

web development's Avatar, Join Date: Jun 2009
Newbie Member
What is the difference between an Interface and an Abstract class?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Here are some of them
  1. Abstract classes can have implementations for some of its members (Methods), but the interfaces can't have implementation for any of its members.
  2. An interface can extend another interface, but cannot extend an abstract class.
  3. All variable in interfaces are final by default
  4. Interfaces provide a form of multiple inheritance. A class can extend only one other class at least in Java and C#
  5. In Abstract Class atleast one of its method needs to be defined in subclass where as in interface all methods needs to be defined in subclass.
  6. Accessibility like Public/Private/protected are only allowed in abstract class and not in Interface
0
gkumar's Avatar
Banned
1) Abstract class defines few or none of the methods, but
interface defines all the methods..
2) Abstract classes should have subclasses else that will
be useless..
Interfaces must have implementations by other classes else
that will be useless
3)only an interface can extend another interface, but any
class can extend an abstract class..
4)All variable in interfaces are final by default