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
How does an appdomain get created?
how to create applications by using Visual Studio 2012?
What is Opf3
What is the procedure on hardware that converts the ascii value to binary? : .NET Architecture
What is an interrupt? : .NET Architecture
How to prevent my .NET DLL to be decompiled?
What is a managed code is dim fs as filestreamobject is a managed code? : .NET Architecture
What is the difference between machine config vs. Web config : Dot net architecture
Explain domestic architecture artifacts? : Dot net architecture
Explain pipelining? : Dot net architecture
what is the difference between running an application with and without debugger?
Explain about .net garbage collector?
What happens when you try to update data in a dataset in .net while the record is already deleted in sql server as backend?
What is an asssembly qualified name? Is it a filename? How is it different?
I want to create a project like google maps how can we do that with atlas?