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: 
I think that you could find interesting the use of Template method pattern. Probably it solution your problem.

<http://en.wikipedia.org/wiki/Template_method_pattern>

```
public abstract class MainClass {

    public final void sharingcode() {
        // content from MainClass
        // write here the common code

        concreteCode(); // Calling abstract method to be implemented by implementations
    }

    protected abstract void concreteCode();

    public class FirstClass extends MainClass {

        @Override
        public void concreteCode() {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

    }

    public class SecondClass extends MainClass {

        @Override
        public void concreteCode() {
            throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
        }

    }
}

```
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();
}   

```