Question: Is it possible to modify or extend the content of a method of an abstract class? 

```
public abstract class MainClass{
    public void func(){
        // content...
    }
}

public class FirstClass extends MainClass{
    public void func(){
        // content from MainClass
        // own content
    }
}
public class SecondClass extends MainClass{
    public void func(){
        // content from MainClass
        // other content
    }
}

```

I need the method `func` in both classes, but with a small modification.

Answer: 
The following:

```
public abstract void func(){
    // content...
}

```

cannot exist as an abstract method has no body. If you had an abstract method with a body, it would be a compile-time error.

However, you can always [call the superclass method](http://docs.oracle.com/javase/tutorial/java/IandI/super.html):

```
public class MainClass{
    public void func(){
        // base content...
    }
}

public class FirstClass extends MainClass{
    public void func(){
        super.func();
        // own content
    }
}
public class SecondClass extends MainClass{
    public void func(){
        super.func();
        // other content
    }
}

```
I think Ezequiel is the best answer here, but wanted to present the Strategy Pattern as another option. You basically forgo subclassing, and inject the difference in behaviour into MainClass:

```
public abstract class MainClass{
    private final Behaviour behaviour;

    public MainClass(Behaviour behaviour) {
        this.behaviour = behaviour;
    }

    public void func(){
        // content...
        behaviour.execute();
    }
}

public interface Behaviour {
    void execute();
}   

```