Difference between abstract class and Interfaces?
Answer Posted / taresh nama
• Interfaces provide a form of multiple inheritances.
A class can extend only one other class.
• Interfaces are limited to public methods and
constants with no implementation. Abstract classes can have
a partial implementation, protected parts, static methods,
etc.
• A Class may implement several interfaces. But in
case of abstract class, a class may extend only one
abstract class.
• Interfaces are slow as it requires extra
indirection to to find corresponding method in in the
actual class. Abstract classes are fast.
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is hashmap and map?
What loop means?
Why do people says “java is robust”?
Explain the pointers in Java?
Explain a few methods of overloading best practices in java?
Can singleton class be inherited in java?
Is set ordered?
In the below example, what will be the output?
What are namespaces in java?
Can we change the value of static variable?
What is a treeset class?
Is there a way to increase the size of an array after its declaration?
Explain thread in java?
What is immutable state?
What is finalize()? Is finalize() similar to a destructor?