Difference between abstract class and interface

Answer Posted / ramani krunal

1. interface contains methods that must be abstract;
abstract class may contain concrete methods.
2. interface contains variables that must be static and
final; abstract class may contain non-final and final variables.
3. members in an interface are public by default,
abstract class may contain non-public members.
4. interface is used to "implements"; whereas abstract
class is used to "extends".
5. interface can be used to achieve multiple inheritance;
abstract class can be used as a single inheritance.
6. interface can "extends" another interface, abstract
class can "extends" another class and "implements" multiple
interfaces.
7. interface is absolutely abstract; abstract class can
be invoked if a main() exists.
8. interface is more flexible than abstract class because
one class can only "extends" one super class, but
"implements" multiple interfaces.
9. If given a choice, use interface instead of abstract
class.

Is This Answer Correct ?    0 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the types of memory management? : Dot net architecture

498


How cache coherency is eliminated? : Dot net architecture

514


Explain different pipelining hazards? : Dot net architecture

470


What is application frame host?

590


Explain different pipelining hazards and how are they eliminated? : Dot net architecture

493






I can't be bothered with cas. Can I turn it off?

528


What is a virtual memory? : Dot net architecture

529


How does .net remoting work?

615


Explain the five stages in a dlx pipeline? : Dot net architecture

486


What is the difference between l1 and l2 cache? : Dot net architecture

519


Explain about httpruntime.cach.get(); method?

569


What is a service class?

535


Differences between VS 2005, 2008 and 2010 ?

574


how to delete the record using data reader

1856


Session State and can i store desirialized object in state server, if yes how and if not why.

1346