Difference between abstract class and interface

Answer Posted / rama krishna

Abstract class:

*A class of only Concrete or only Abstract or both.

*Any java class can extend only one abstract class.

*It won’t force the programmer to implement/override all its methods.

*It takes less execution time than interface.

* It allows constructor.

This class can’t be instantiated directly.

A class must be abstract when it consist at least one abstract method.

It gives less scope than an Interface.

It allows both variable & constants declaration.


It allows methods definitions or declarations whenever we want.

It gives reusability hence it can’t be declared as “final”.

Interface:

only abstract methods.


A class can implements any no. of interfaces
(this gives multiple interface inheritance )

It forces the programmer to implement all its methods

Interface takes more execution time due to its complex hierarchy.
* It won’t allow any constructor.

It can’t be instantiated but it can refer to its subclass objects.



It gives more scope than an abstract class.

By default, methodspublic abstract
variablespublic static final.


It allows methods declarations whenever we want . But it involves complexity.

Since they give reusability hence they must not be declared as “final”.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what are the events for a form?

1828


Waht is Dot net Arcitecture

2130


What is .net transaction?

669


Explain a .net mobile example with details? : Microsoft dot net mobile

638


Explain is development of a mobile web application with asp.net is very easy? : Microsoft dot net mobile

700


HttpHendler and HttpModules

1894


What does the term "green architecture" mean? : .NET Architecture

716


Explain what does the term "green architecture" mean? : Dot net architecture

752


data types used in validation control

1920


Explain difference between machine config vs. Web config? : .NET Architecture

716


What is the difference between primary & secondary storage device? : Dot net architecture

714


Difference between throw exception and rethrowing ?

1842


What is the procedure on hardware that converts the ascii value to binary? : .NET Architecture

719


Can you explain update progress control?

692


Explain .net mobile events? : Microsoft dot net mobile

682