I wrote an article about that:

Abstract classes and interfaces

Summarizing:

When we talk about abstract classes we are defining characteristics of an object type; specifying what an object is.

When we talk about an interface and define capabilities that we promise to provide, we are talking about establishing a contract about what the object can do.

Answer from Jorge Cรณrdoba on Stack Overflow
๐ŸŒ
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 - In addition to these, Java 8 new features support static and default methods in interfaces to support backward compatibility. Methods in an interface are implicitly abstract if they are not static or default and all are public.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ java โ€บ difference-between-abstract-class-and-interface-in-java
Difference Between Abstract Class and Interface in Java - GeeksforGeeks
Can have member variables: Abstract classes can have member variables, which are variables that belong to an instance of the class. These variables can be final, non-final, static, or non-static. Can be used as a base class: Abstract classes can be used as a base class for other classes, which means they can be inherited by other classes. This allows for code reuse and the creation of a common interface or behavior for related classes.
Published ย  July 23, 2025
๐ŸŒ
InfoWorld
infoworld.com โ€บ home โ€บ blogs โ€บ java challengers
When to use abstract classes vs. interfaces in Java | InfoWorld
December 6, 2023 - Remember that an interface is a kind of contract that must be implemented by a concrete class. Interface methods are implicitly abstract, and also require a concrete class implementation.
๐ŸŒ
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 - Abstract classes can contain both ... It is typically used when you want to define common functionality for a group of subclasses, but also leave some methods for those subclasses to implement....
๐ŸŒ
InfoWorld
infoworld.com โ€บ home โ€บ blogs โ€บ .net programming
When to use an abstract class vs. interface in C# | InfoWorld
June 20, 2024 - You can take advantage of an interface or an abstract class to define a contract that must be followed by types that extend or implement that interface or abstract class. For example, you can define methods, properties, and events in an interface or an abstract class that must be implemented by types that extend it. However, from C# 8.0 onward, an interface can contain default implementations for its members, i.e. methods and properties. No instantiation: You can use both abstract classes and interfaces to define types that cannot be instantiated.
๐ŸŒ
Reddit
reddit.com โ€บ r/csharp โ€บ whats the difference between interface and abstract class? are they not use the same way?
r/csharp on Reddit: Whats the difference between Interface and Abstract class? Are they not use the same way?
October 29, 2020 - So if you want to inherit from a class, this class should be abstract. But I use interfaces when I need to show some abillity of the class. It's convenient when you see what a class can do just by looking at its interfaces.
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ when-to-use-an-abstract-class-and-when-to-use-an-interface-in-java
When to use an abstract class and when to use an interface in Java?
Abstract classes provide a simple and easy way to version our components. By updating the base class, all inheriting classes are automatically updated with the change. Interfaces, on the other hand, cannot be changed once created. If a new version of an interface is required, we must create ...
Find elsewhere
Top answer
1 of 3
4

I like to think of interfaces as contracts (this object will have property X & Y and method Z) but makes no assumptions about implementation (at least they did before Default Interface Implementations as of C# 8: https://devblogs.microsoft.com/dotnet/default-implementations-in-interfaces, although I use these sparingly if ever).

Abstract classes (and derived non-sealed classes) can be thought of as just a place to share implementation that's common between supersets of classes and their subsets. Abstract classes provide an object-oriented way of supporting the Don't Repeat Yourself (DRY) principle (https://www.c-sharpcorner.com/article/software-design-principles-dry-kiss-yagni) where the implementation you would otherwise repeat doesn't make sense outside of the context of your class hierarchy.

Interfaces & abstract classes are by no means mutually exclusive and can be used in conjunction with each other depending on the context.

2 of 3
1

abstract classes are to define a common base class for inheritance, without implementing any actual methods.

because c# does not support multiple inheritance, interfaces are the solution. a class can inherit from one base class, but it can implement many interfaces. interfaces can only be implemented. an interface can not inherit from another interface.

due to issues with inheritance chains, inheritance is often considered an anti-pattern, interface design is recommend instead. with interface design you define contacts that define properties and methods. then classes must implement. other languages use protocols/traits which are slight more feature rich than interfaces.

one past advantage with classes, was you could define default behavior, and interfaces were abstract (no implementations). But modern C# allows default implemations for interfaces.

so my recommendation is to avoid class inheritance (and never more than 1 deep, that is only inherit from base), but rather use interfaces and extension methods to extend classes.

๐ŸŒ
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 - We can run an abstract class if ... have main method implementation. Interfaces are used to define contract for the subclasses whereas abstract class also define contract but it can provide other methods implementations for subclasses to use....
๐ŸŒ
Guru99
guru99.com โ€บ home โ€บ java tutorials โ€บ difference between abstract class and interface in java
Difference Between Abstract Class and Interface in Java
November 25, 2024 - Allows you to separate the definition ... the subclasses. ... Abstract class allows code reusability. The interface is a blueprint that can be used to implement a class....
๐ŸŒ
Javatpoint
javatpoint.com โ€บ difference-between-abstract-class-and-interface
Abstract vs Interface - javatpoint
Difference between Abstract class and Interface or difference between interface and abstract class in java or abstract class vs interface in abstraction with example of abstract class and example of interface,abstract class vs interface in java, example of abstract class and interface in java
๐ŸŒ
ByteHide
bytehide.com โ€บ home โ€บ abstract class vs interface in c#: pros and cons
Abstract Class vs Interface in C#: Pros and Cons
March 27, 2025 - As a general rule, you should use ... other classes in a class hierarchy. If you need to define a behavior that can be implemented by multiple unrelated classes, you should use an interface....
๐ŸŒ
QuickStart
quickstart.com โ€บ blog โ€บ software-engineering โ€บ when-and-how-to-use-abstract-class-and-interface
Abstract Classes vs. Interfaces: Decoding the OOP Dilemma in Software Engineering | QuickStart
September 24, 2024 - Interfaces: Use interfaces when there is no inherent "is-a" relationship, and multiple unrelated classes need to adhere to a common contract. Interfaces promote a "can-do" relationship where classes declare what they can do without specifying ...
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ differences-between-abstract-class-and-interface-in-java
Differences between abstract class and interface in Java
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"); } } ... Differences between Interface and Integration Testing.
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.

Top answer
1 of 5
2

Note: please forgive the C# syntax, but the principle of the answer is the same for Java and C#.

Now when i started programming I noticed that in all subclasses i basically needed to do the exact same thing

Based on this, it seems like you think abstract classes are only allowed to declare abstract methods. This is not the case.

An abstract class is a class that cannot be instantiated directly (only its derivations can be instantiated). An abstract method is a method in an abstract class which must be implemented in the derived class.

But an abstract class can have non-abstract methods:

public abstract class Artikel
{
    public int ArtikelId { get; set; }

    public string SayHello()
    {
        return "Hi, I'm artikel " + ArtikelId;
    }
}

When you derive Artikel into subclasses, you do not need to repeat the method body of the SayHello method. Its body has been declared in the base class and can be used by all of the derived classes.

I thought of making Artikel not abstract and put an interface between Artikel and the other classes

Interfaces prevent the ability to create a common method body. If you were to use an interface:

public interface IArtikel
{
    string SayHello();
}

Then you will be required to implement this method separately in every class:

public class Book : IArtikel
{
    public string SayHello()
    {
        // custom book logic
    }
}

// And the same for all other derived classes.

It's also possible to make an seperate class which inherits from Artikel where I can put all the methods, but then there the methods would still be needed to made three times, one for each subclass right?

Don't take this the wrong way, but your attempts at solving this suggest you don't really master OOP. If this SeparateClass was created as another (4th) subclass from Artikel, how would you expect e.g. the Book class to rely on the methods found in SeparateClass?

Is it a bad design choice if I keep Artikel as abstract?

Keep Artikel abstract, but give it non-abstract methods (i.e. with method bodies) for each method that you are now copy/pasting between all of its subclasses.

2 of 5
1

You can have a base class as an abstract class which implements the Artikel interface. In the abstract class you can define the common implementation. Then you can derive LP, Book and Boardgame from that super class. In my opinion it is better to have a abstract class rather than copying the same code in all 3 sub classes.

๐ŸŒ
C# Corner
c-sharpcorner.com โ€บ article โ€บ when-to-use-abstract-class-and-interface-in-real-time-projects
When To Use Abstract Class and Interface In Real Projects
November 18, 2021 - Abstract classes provide you the flexibility to have certain concrete methods and some other methods that the derived classes should implement. On the other hand, if you use interfaces, you would need to implement all the methods in the class ...
๐ŸŒ
The Knowledge Academy
theknowledgeacademy.com โ€บ blog โ€บ abstract-class-vs-interface-java
Abstract Class vs Interface Java: A Detailed Comparison
You can use Abstract Classes when you want to provide shared implementation and create a hierarchical class structure. In contrast, interfaces are preferable for defining contracts unrelated classes, further promoting flexibility and multiple ...