Interfaces are used for broader systems, where the classes that implement it are not necessarily related. Whereas, usually,classes extending an abstract class would be somewhat related, such as a list in your case. Also interfaces only guarantee behavior, and the methods will need to be implemented in the classes implementing them. Abstract classes can define methods that will be used in classes extending them to promote code reuse. Answer from Laghacksyt on reddit.com
🌐
GeeksforGeeks
geeksforgeeks.org › java › difference-between-abstract-class-and-interface-in-java
Difference Between Abstract Class and Interface in Java - GeeksforGeeks
As we know that abstraction refers to hiding the internal implementation of the feature and only showing the functionality to the users. i.e., showing only the required features, and hiding how those features are implemented behind the scene. Whereas, an Interface is another way to achieve abstraction in Java. Both abstract class and interface are used for abstraction.
Published   July 23, 2025
Discussions

What's the difference between an Abstract Class and Interface in Java ?
home / developersection / forums / what's the difference between an abstract class and interface in java ? More on mindstick.com
🌐 mindstick.com
0
September 6, 2019
Abstract class vs Interface
As a rule of thumb, I think of interfaces as "type definitions" and abstract classes as "partial implementation definitions." Technically, an interface and type definition could mean two different things, especially in Java but also depending on the language you use, but I find it useful to think of it this way because it entails that the interface specifies a contract but doesn't specify anything about how the thing is implemented. For that reason, it's more lightweight and easier to pass around and use. Abstract classes could technically be used "as" interfaces, but it generally carries a bit more baggage, as it entails that there is some kind of implementation going on that the user cares about. Usually, an abstract class defines some core functionality but leaves the rest to the subclass, so anyone looking to use an interface vs abstract class (if both are available) would only choose the abstract class as a type if they want something specifically from that class's implementation. Overall, interfaces are lightweight and simple to use, since they carry less baggage and can be substituted more easily, whereas abstract classes provide useful core implementations but restrict the user from using other classes that conform to that interface but don't inherit from that abstract class. More on reddit.com
🌐 r/learnjava
11
9
February 18, 2024
object oriented design - What are the differences between abstract classes, interfaces, and when to use them - Software Engineering Stack Exchange
Despite all that above, if you ... why of abstract classes and interfaces altogether, by all means let a valid answer to be stop thinking in this direction and suggest the proper way to move forward! ... There are lot of good examples online. I think this is one among them. javapapers.com/core-... More on softwareengineering.stackexchange.com
🌐 softwareengineering.stackexchange.com
November 3, 2012
What is the difference between an Interface and an Abstract class?

In terms of code, they're very similar, which often raises confusion like yours.

Conceptually, I think of it this way. When you inherit from an abstract class, you're saying that you are a type of the class. You have the same attributes.

When you implement an interface, you're saying that you do the things that that interface does.

In one sentence, abstract classes allow you to inherit state/variables/data, interfaces allow you inherit behaviors.

More on reddit.com
🌐 r/java
27
13
February 21, 2013
Top answer
1 of 16
581

I will give you an example first:

public interface LoginAuth{
   public String encryptPassword(String pass);
   public void checkDBforUser();
}

Suppose you have 3 databases in your application. Then each and every implementation for that database needs to define the above 2 methods:

public class DBMySQL implements LoginAuth{
          // Needs to implement both methods
}
public class DBOracle implements LoginAuth{
          // Needs to implement both methods
}
public class DBAbc implements LoginAuth{
          // Needs to implement both methods
}

But what if encryptPassword() is not database dependent, and it's the same for each class? Then the above would not be a good approach.

Instead, consider this approach:

public abstract class LoginAuth{
   public String encryptPassword(String pass){
            // Implement the same default behavior here 
            // that is shared by all subclasses.
   }

   // Each subclass needs to provide their own implementation of this only:
   public abstract void checkDBforUser();
}

Now in each child class, we only need to implement one method - the method that is database dependent.

2 of 16
228

Nothing is perfect in this world. They may have been expecting more of a practical approach.

But after your explanation you could add these lines with a slightly different approach.

  1. Interfaces are rules (rules because you must give an implementation to them that you can't ignore or avoid, so that they are imposed like rules) which works as a common understanding document among various teams in software development.

  2. Interfaces give the idea what is to be done but not how it will be done. So implementation completely depends on developer by following the given rules (means given signature of methods).

  3. Abstract classes may contain abstract declarations, concrete implementations, or both.

  4. Abstract declarations are like rules to be followed and concrete implementations are like guidelines (you can use it as it is or you can ignore it by overriding and giving your own implementation to it).

  5. Moreover which methods with same signature may change the behaviour in different context are provided as interface declarations as rules to implement accordingly in different contexts.

Edit: Java 8 facilitates to define default and static methods in interface.

public interface SomeInterfaceOne {

    void usualAbstractMethod(String inputString);

    default void defaultMethod(String inputString){
        System.out.println("Inside SomeInterfaceOne defaultMethod::"+inputString);
    }
}

Now when a class will implement SomeInterface, it is not mandatory to provide implementation for default methods of interface.

If we have another interface with following methods:

public interface SomeInterfaceTwo {

    void usualAbstractMethod(String inputString);

    default void defaultMethod(String inputString){
        System.out.println("Inside SomeInterfaceTwo defaultMethod::"+inputString);
    }

}

Java doesn’t allow extending multiple classes because it results in the “Diamond Problem” where compiler is not able to decide which superclass method to use. With the default methods, the diamond problem will arise for interfaces too. Because if a class is implementing both

SomeInterfaceOne and SomeInterfaceTwo

and doesn’t implement the common default method, compiler can’t decide which one to chose. To avoid this problem, in java 8 it is mandatory to implement common default methods of different interfaces. If any class is implementing both the above interfaces, it has to provide implementation for defaultMethod() method otherwise compiler will throw compile time error.

🌐
Baeldung
baeldung.com › home › java › core java › using an interface vs. abstract class in java
Using an Interface vs. Abstract Class in Java | Baeldung
June 24, 2025 - We can have instance and static initialization blocks in an abstract class, whereas we can never have them in the interface. Abstract classes may also have constructors which will get executed during the child object’s instantiation. Java 8 introduced functional interfaces, an interface with a restriction of no more than one declared abstract method.
🌐
MindStick
mindstick.com › forum › 95339 › what-s-the-difference-between-an-abstract-class-and-interface-in-java
What's the difference between an Abstract Class and Interface in Java ? – MindStick
September 6, 2019 - A primary difference is the use ... is that a class which implements an interface must implement all the methods of the interface while a class which inherits from an abstract class doesn't require the implementation of all the methods of its superclass...
🌐
Scaler
scaler.com › topics › java › difference-between-abstract-class-and-interface
Difference between Abstract Class and Interface in Java - Scaler Topics
February 16, 2022 - It serves as a template for other classes to extend and provides common functionality to its subclasses. On the other hand, an interface in Java is a reference type that contains only abstract methods, constants, and nested types.
🌐
Medium
harsh05.medium.com › abstract-classes-vs-interfaces-in-java-when-and-how-to-use-them-5ca5d5c825b5
Abstract Classes vs Interfaces in Java: When and How to Use Them | by @Harsh | Medium
October 10, 2024 - Along the way, I also explored how multiple inheritance, although not directly supported in Java, can be achieved using interfaces. ... An abstract class in Java is a class that cannot be instantiated on its own. Instead, it serves as a blueprint for other classes that extend it.
Find elsewhere
🌐
DigitalOcean
digitalocean.com › community › tutorials › difference-between-abstract-class-and-interface-in-java
Difference between Abstract Class and Interface in Java | DigitalOcean
August 4, 2022 - Abstract classes can have constructors but interfaces can’t have constructors. Abstract class have all the features of a normal java class except that we can’t instantiate it.
🌐
TutorialsPoint
tutorialspoint.com › differences-between-abstract-class-and-interface-in-java
Differences between abstract class and interface in Java
Following are the important differences between abstract class and an interface. public class JavaTester { public static void main(String args[]) { Animal tiger = new Tiger(); tiger.eat(); Cat lion = new Lion(); lion.eat(); } } interface Animal { public void eat(); } class Tiger implements Animal { public void eat(){ System.out.println("Tiger eats"); } } abstract class Cat { abstract public void eat(); } class Lion extends Cat{ public void eat(){ System.out.println("Lion eats"); } }
🌐
Oracle
docs.oracle.com › javase › tutorial › java › IandI › abstract.html
Abstract Methods and Classes (The Java™ Tutorials > Learning the Java Language > Interfaces and Inheritance)
Abstract classes are similar to interfaces. You cannot instantiate them, and they may contain a mix of methods declared with or without an implementation. However, with abstract classes, you can declare fields that are not static and final, and define public, protected, and private concrete methods.
🌐
Reddit
reddit.com › r/learnjava › abstract class vs interface
r/learnjava on Reddit: Abstract class vs Interface
February 18, 2024 -

Hey everyone, thanks for dropping by, recently learnt about abstract class and interface at school.

In work experience, when would you use abstract class and interfaces vice versa, what’s the benefit over the other?

Interface, for me it is wonderful because it is a contract and we need to implement all the method, makes the class implements the interface much easier to understand.

What’s your view and experience on the two? Thank you for your time

Top answer
1 of 5
13
As a rule of thumb, I think of interfaces as "type definitions" and abstract classes as "partial implementation definitions." Technically, an interface and type definition could mean two different things, especially in Java but also depending on the language you use, but I find it useful to think of it this way because it entails that the interface specifies a contract but doesn't specify anything about how the thing is implemented. For that reason, it's more lightweight and easier to pass around and use. Abstract classes could technically be used "as" interfaces, but it generally carries a bit more baggage, as it entails that there is some kind of implementation going on that the user cares about. Usually, an abstract class defines some core functionality but leaves the rest to the subclass, so anyone looking to use an interface vs abstract class (if both are available) would only choose the abstract class as a type if they want something specifically from that class's implementation. Overall, interfaces are lightweight and simple to use, since they carry less baggage and can be substituted more easily, whereas abstract classes provide useful core implementations but restrict the user from using other classes that conform to that interface but don't inherit from that abstract class.
2 of 5
8
Abstract classes are great for defining a base entity that other classes should inherit from. Think like Executive extends Employee or CalculationSummaryCache extends SummaryCache Interfaces define behavior and not necessarily a parent type. You can have many unrelated classes implement a particular interface, whereas unrelated classes inheriting from an abstract class would be inappropriate. Think of an interface that requires its implementers produceCsvReport(). The implementing classes need not be related to each other at all, they just need to uphold the contract.
Top answer
1 of 6
38

In layman's terms:

Interfaces are for "can do/can be treated as" type of relationships.

Abstract ( as well as concrete ) classes are for "is a" kind of relationship.

Look at these examples:

class Bird extends Animal implements Flight;
class Plane extends Vehicle implements Flight, AccountableAsset;
class Mosquito extends Animal implements Flight;
class Horse extends Animal;
class RaceHorse extends Horse implements AccountableAsset;
class Pegasus extends Horse implements Flight;

Bird, Mosquito and Horse are Animals. They are related. They inherit common methods from Animal like eat(), metabolize() and reproduce(). Maybe they override these methods, adding a little extra to them, but they take advantage of the default behavior implemented in Animal like metabolizeGlucose().

Plane is not related to Bird, Mosquito or Horse.

Flight is implemented by dissimilar, unrelated classes, like Bird and Plane.

AccountableAsset is also implemented by dissimilar, unrelated classes, like Plane and RaceHorse.

Horse doesn't implement Flight.

As you can see classes (abstract or concrete) helps you build hierarchies, letting you inhering code from the upper levels to the lower levels of the hierarchy. In theory the lower you are in the hierarchy, the more specialized your behavior is, but you don't have to worry about a lot of things that are already taken care of.

Interfaces, in the other hand, create no hierarchy, but they can help homogenize certain behaviors across hierarchies so you can abstract them from the hierarchy in certain contexts.

For example you can have a program sum the value of a group of AccountableAssets regardless of their being RaceHorses or Planes.

2 of 6
13

You could deduce the answer logically since you seem to be aware of the differences between the two.

Interfaces define a common contract. Such as an interface called IAnimal, where all animals share functions such as Eat(), Move(), Attack() etc. While all of them share the same functions, all or most of them have a different way (implementation) of achieving it.

Abstract classes define a common implementation and optionally common contracts. For example a simple Calculator could qualify as an abstract class which implements all the basic logical and bitwise operators and then gets extended by ScientificCalculator, GraphicalCalculator and so on.

If you have common implementation then by all means, encapsulate the functionality in an abstract class to extend from. I have near 0 PHP experience, but i don't think you can create interfaces with non constant fields. If the fields are common between your instance classes then you are forced to use an Abstract class, unless you define access to them via getters and setters.

Also, there seems to be no shortage of results in Google.

🌐
InfoWorld
infoworld.com › home › blogs › java challengers
When to use abstract classes vs. interfaces in Java | InfoWorld
December 6, 2023 - It’s a good idea to use an abstract class when you need to implement mutable state. As an example, the Java Collections Framework includes the AbstractList class, which uses the state of variables. In cases where you don’t need to maintain the state of the class, it’s usually better to use an interface.
🌐
Simplilearn
simplilearn.com › home › resources › software development › abstract class vs interface java: understanding abstraction in java
Abstract Class vs Interface Java: A Complete Guide | Simplilearn
June 10, 2025 - How do you define the abstract class & interface in Java? Being the main building blocks of Java, learn the major abstract class vs interface java differences.
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Coderanch
coderanch.com › t › 773633 › java › abstract-interfaces-don-understand
abstract and interfaces - I don't know if I understand it. (Beginning Java forum at Coderanch)
June 23, 2023 - Abstract classes may additionally contain abstract methods. These consist of only a declaration, no implementation. The implementation is given by a class that extends the abstract class. Interfaces consist of declarations only*. They are like an abstract class, but without any implementations.
🌐
Shiksha
shiksha.com › home › it & software › it & software articles › programming articles › difference between abstract class and interface in java
Difference between Abstract class and Interface in Java - Shiksha Online
December 19, 2022 - In Java abstraction is achieved through both abstract class and interface. Main difference between abstract class and interface is the way they are implemented.
🌐
BYJUS
byjus.com › gate › difference-between-abstract-class-and-interface-in-java
Difference between Abstract Class and Interface in Java
February 16, 2024 - An abstract class contains an abstract keyword on the declaration whereas an Interface is a sketch that is used to implement a class. Explore more differences between abstract class and interface in java.
🌐
W3Schools
w3schools.com › java › java_interface.asp
Java Interface
Interface methods do not have a body - the body is provided by the "implement" class · On implementation of an interface, you must override all of its methods · Interface methods are by default abstract and public · Interface attributes are by default public, static and final · An interface cannot contain a constructor (as it cannot be used to create objects) 1) To achieve security - hide certain details and only show the important details of an object (interface). 2) Java does not support "multiple inheritance" (a class can only inherit from one superclass).
🌐
Hero Vired
herovired.com › home › learning-hub › blogs › difference-between-abstract-class-and-interface
Difference Between Abstract Class and Interface in Java
April 23, 2024 - Interfaces, on the other hand, can only have abstract methods, do not provide implementations, and support multiple inheritance through implementation. This article will help you understand the key differences between abstract class vs interface, two of the main building blocks of the Java programming language.