Difference between abstract class and interface

Answer Posted / ratikant patra

1.*Abstract class may contain abstract methods,constru-
-ctors,concrete methods,fields....
*interface only contain signature of methods and
fields.

2. *All access specifiers are allowed to class members in
abstract class.By default scope is package or public
depends on programming.
*But data fields and method signatures bydefault final
and public.

****WE KNOW JVM TREATS FINAL METHODS AS INLINE. SO, DYNAMIC-
POLYMORPHISM THROUGH INTERFACE IS FASTER THAN OTHER.
************

3.Abstract class always a super class,only can beextended.
But interface only can be implimented.

4.Code reusability possible by extending abstract classes
*But code reusability not possible using interface.

5.Abstract class is used when programmer need to maintain
property of super class in sub classes i.e. programmer
may override complete methods(but bound to redefine
abstract methods.unless sub class becomes abstract).
*In case of classes implimenting interface must define
all the methods.

6.At a time we can extend only abstract class.
*But we can impliment many interfaces to a class.

RATIKANT PATRA,KIST,BBSR

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is .net mobile utility controls. : Microsoft dot net mobile

686


hi, kindly send WWF(.net 3.5) pdf notes to my id. thanx in advance, chays

2062


how can we achieve language interoperability through CLS? How MSIL works?

817


What is the purpose of cache? : Dot net architecture

707


Explain cache memory? : Dot net architecture

702


Explain the Lapsed Listener problem in .net

829


How to prevent my .NET DLL to be decompiled?

761


What is cookie less session?

748


What is a service class?

728


Difference between throw exception and rethrowing ?

1833


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

770


What are the major differences between services and web services?

690


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

695


What is gui programming? : .NET Architecture

684


What are the options provived by vss to the user? how it will help us while delevoping application?

1958