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
What is the procedure on hardware that converts the ascii value to binary? : .NET Architecture
What are relation objects in dataset?
Define cache coherency and how is it eliminated? : Dot net architecture
Does .NET runtime offer Deterministic Destruction or not?
I can't be bothered with cas. Can I turn it off?
What is the use of web.config?
Explain hard disk and what is its purpose? : Dot net architecture
Define cache? : Dot net architecture
Explain different pipelining hazards and how are they eliminated? : Dot net architecture
What are different types that a variable can be defined and their scopes ?
What is a managed code? : Dot net architecture
What is cache coherency and how is it eliminated? : Dot net architecture
What is a service contract, operation contract and data contract?
What is .net mobile images control. : Microsoft dot net mobile
Define cache coherency? : Dot net architecture