ALL >> Education >> View Article
Explain Difference Between Interface Abstract Class
What is the difference between interface and abstract class in
Java? is the most frequently asked question in Java Interview and
it is one of the toughest question to answer. After the introduction
of Java 8 this has become quite tougher because the interfaces for
both static and default methods can be included in the default
methods, in this new version.
There are some interview panel members who also check for the
practical experience of the candidates on when to use interface in
Java rather than just focusing on the difference.
This is very tough
to answer and one must have a very good knowledge about
interface and abstract class in Java. Therefore, you need to keep in
mind that if you are preparing for Java Programming Interview
then you also refer a book of Java concepts named as Java
Programming Interview Exposed.
In it, there are lots of important questions and topics included
Eg: multi threading, OOPS concepts, collections, frameworks
similar to Hibernate and Spring, data structure, unit testing and
algorithms apart from that recent technology questions like Scala,
Android, and other JVM languages.
Abstract class vs Interface in Java
1) An Interface is an interface and an abstract class is a class and
this is the major difference between abstract class and an interfacewhich implies that by extending the abstract class it is not possible
to extend another class as Java does not support multiple
inheritances but it is possible to implement multiple inheritance in
2) It is not possible to create a non-abstract method in an interface,
is the second difference between interface and abstract class and it
is by default abstract. You can develop a non-abstract method in
abstract class. With the help of abstract keyword a class which
does not contain any abstract method can be made abstract.
3) For type declaration interface is best suited and for reusing the
code and evolution perspective abstract class is used. Why there is
a need to use interface for type declaration can be explained by the
book “Effective Java” very well.
4) Abstract class are faster when compared to interface because
before calling any overridden method in Java there is a search
carried out by the interface. Although it is of not that importance it
works well in time critical application.
5) If a new method is added in an existing interface then the
interface which is present breaks all the implementation and it is
necessary to implement all the clients that is not advisable. A
default implementation can be provided with the help of an
abstract class for a new method without breaking the current
Education Articles1. What Subjects Will Be Taught In Bba Course
2. Boarding School In Kolhapur – Mit Vishwashanti Gurukul
Author: MIT Vishwashanti Gurukul
3. 5 Ways To Teach Islam To Kids
Author: Mishary Alafasy
4. Introduction To Big Data
5. What Makes Sushi Making Class In Boston So Popular?
Author: Reginald Gideon
6. Agriculture And The Pandemic
Author: Current Affairs Review
7. Which Is The Best Safety Training Institute In Uae?
Author: Green World
8. 5 Futuristic Technical Skills That The Best Boarding School Teaches
Author: Swarnprastha Public School
9. What Is Equine Massage Certification And Therapy?
Author: Maria Hernandez
10. Know-how Education System Is Emerging With The Technology
Author: My schoolr
11. Boost Your Self Esteem And Confidence
Author: Umar hameed
12. Pmp Certification: Make A Successful And Glorious Career In Project Management
Author: Avan Jack
13. Reactjs Framework Articles You Should Read
Author: siyaram yadav
14. Many Auditor Jobs Availed Iso 14001 Lead Auditor Course
Author: Green World
15. Wordpress Website Development Training Institute In Faridabad
Author: kiran sharma