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

readonly syntax ?

1418


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

575


Can I create my own context attributes?

568


What is .net mobile images control. : Microsoft dot net mobile

497


12. Types of polymorphisem[Run and Design Exp.]

1652






What happens to the winfx technologies?

578


Explain how cache is used? : Dot net architecture

589


What is .net mobile automatic paging? : Microsoft dot net mobile

586


What is the mesi? : .NET Architecture

607


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

554


How cache is used? : Dot net architecture

500


Explain .net mobile events? : Microsoft dot net mobile

526


Explain the types of memory management? : .NET Architecture

525


Differences between VS 2005, 2008 and 2010 ?

584


How cache coherency is eliminated? : Dot net architecture

516