Difference between Abstract Class and Interface:

Most of the people confuses with Abstract class and interface. Here I am planning to share some information with examples, I hope this will help you more………

Simple abstract class looks like this:

public abstract class KarateFight{

public void bowOpponent(){

//implementation for bowing which is common for every participant       }

public void takeStand(){

//implementation which is common for every participant


public abstract boolean fight(Opponent op);

//this is abstract because it differs from person to person


The basic interface looks like this:

public interface KarateFight{

public boolean fight(Opponent op);

public Integer timeOfFight(String person);


The differences between abstract class an interface as fallows:

1.  Abstract class has the constructor, but interface doesn’t.

2.  Abstract classes can have implementations for some of its members (Methods), but the interface can’t have implementation for any of its members.

3.  Abstract classes should have subclasses else that will be useless..

4. Interfaces must have implementations by other classes else that will be useless

5. Only an interface can extend another interface, but any class can extend an abstract class..

6.  All variable in interfaces are final by default

7. Interfaces provide a form of multiple inheritance. A class can extend only one other class.

8. Interfaces are limited to public methods and constants with no implementation. Abstract classes can have a partial implementation, protected parts, static methods, etc.

9.  A Class may implement several interfaces. But in case of abstract class, a class may extend only one abstract class.

10. Interfaces are slow as it requires extra indirection to to find corresponding method in in the actual class. Abstract classes are fast.

11. Accessibility modifier(Public/Private/internal) is allowed for abstract class. Interface doesn’t allow accessibility modifier

12.  An abstract class may contain complete or incomplete methods. Interfaces can contain only the signature of a method but no body. Thus an abstract class can implement methods but an interface can not implement methods.

13.  An abstract class can contain fields, constructors, or destructors and implement properties. An interface can not contain fields, constructors, or destructors and it has only the property’s signature but no implementation.

14. Various access modifiers such as abstract, protected, internal, public, virtual, etc. are useful in abstract Classes but not in interfaces.

15.  Abstract scope is upto derived class.

16.  Interface scope is upto any level of its inheritance chain.

Other Useful Links:

What are the differences between object and instance?

What are the differences between EAR, JAR and WAR file?

Differences between callable statements, prepare statements, createstatements

20 thoughts on “Difference between Abstract Class and Interface:

  1. gopi kanth June 2, 2010 / 5:29 am


    you have given good differences between interface and abstract class.
    i want to add few more points to this post.

    when to use interface and when to use abstract class:
    1)whenever your class going to get high level abstraction.
    2)where project design changes frequently from time to time.
    3)To provide less coupling.

    abstract class:
    1)Abstract class also will give high level abstraction
    2)Along with high level abstraction it will give DEFAULT behavior.

    • revathi August 3, 2011 / 11:22 am

      nice article

  2. mallikarjungunda June 2, 2010 / 5:34 am

    Thanks For your comments gopi,

    Actually i am planning to post on “when to use interface and when to use abstract class” in upcoming posts.

    Thanks for your reply,

  3. anu May 1, 2012 / 9:30 am

    nice and thanks…..

  4. satish May 3, 2012 / 7:27 pm

    best differences…..great work

  5. P. vivek May 22, 2012 / 1:10 pm

    usefull.. thanks … keep doing these activities to encourage students …

  6. prakash June 12, 2012 / 3:21 am

    It makes clear……. tan q…….

    • mallikarjungunda June 19, 2012 / 12:06 pm

      Thanks prakash….

      keep watching this space fr more updates

  7. Subhan July 17, 2012 / 6:26 am

    Thank u Malli

  8. AnilReddy July 30, 2012 / 12:58 pm

    can you give me more practical examples regarding this topic(diff bw abstract class and interface)…..

  9. Ramakrishna. M October 20, 2012 / 5:45 am

    Clear and Nice. Thank you Mallik.

  10. kishore October 25, 2012 / 8:44 am

    class X extends A implements B
    public void m1()
    abstract class A
    public void m1();
    interface B
    public void m1();

    it is compiled but I have a doute which Method is overriding above class X either Abstract class A method m1() nor interface B method m1().
    thnak you

  11. Harikrishna December 17, 2012 / 3:56 pm

    Hi Kishore,
    When a class is deriving from a class and interface, if both have a method with same prototype we need to implement only once, this is the basic rule of inheritance.

    In this example we can say
    class X is overriding the method of class A and also
    class X is implementing the method of interface B

  12. Gowtham R March 5, 2013 / 11:14 am

    In 11th point they have mentioned interface doesn’t allow modifiers, but it can be used.

  13. Anurag Singh March 30, 2018 / 7:51 am

    All the differences, you explained really useful . this is very- very important topic in core java interview.
    thanks for this great post.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.