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


Please Help Members By Posting Answers For Below Questions

What is default exception handling in java?

573


What if the main() method is declared as private? What happens when the static modifier is removed from the signature of the main() method?

686


Can You Have Virtual Functions In Java?

588


What is the history of java?

546


When should I use singleton pattern?

545






Write a program in java to find the maximum and minimum value node from a circular linked list.

521


What do you know about java?

525


How to obtain a performance profile of java program

545


Differentiate between == and equals().

597


Can I declare a class as private?

590


What are the parts of methodology?

549


What is ‘has a’’ relationship in java?

724


How do you convert an int to a string in java?

546


What are extraneous variables examples?

527


What is passing value java?

510