Topic: Java Interview Questions & Answers
What is the difference between interface and abstract class ?
For more Java Interview Questions & Answers visit
You are not logged in. Please login or register.
Rails Forum - Ruby on Rails Help and Discussion Forum » Server-side programming » Java Interview Questions & Answers
What is the difference between interface and abstract class ?
For more Java Interview Questions & Answers visit
The main difference between an abstract class and an interface, is that abstract class is inherited (extended), as normal class, so you cannot extend two of them in parallel, while you can implement more than one interface at the same time.
Last edited by Kenank (2013-02-05 08:24:54)
Java interface should be implemented using keyword “implements”; A Java abstract class should be extended using keyword “extends”.
An interface can extend another Java interface only, an abstract class can extend another Java class and implement multiple Java interfaces.
A Java class can implement multiple interfaces but it can extend only one abstract class.
Interface is absolutely abstract and cannot be instantiated; A Java abstract class also cannot be instantiated, but can be invoked if a main() exists.
In comparison with java abstract classes, java interfaces are slow as it requires extra indirection.
Hosting provided by aTech Media