ERROR - Abstract method do not specify a body


Error

Abstract method do not specify a body

Error Type 

Compile Time

Sample Code 

public abstract class ParentTest {
    private String element = "Hello";

    abstract public String getString(){
    return element;
    }
    
    public void method(){
    getString();
    }
}

Cause

Method declared abstract cannot have body in the parent class. 

Resolution

Either remove the abstract method body

public abstract class ParentTest {
    private String element = "Hello";

    abstract public String getString();
    
    public void method(){
    getString();
    }
}

or make it non abstract

public abstract class ParentTest {
    private String element = "Hello";

    public String getString(){
    return element;
    }
    
    public void method(){
    getString();
    }
}


If the error is being thrown in the interface body ( with Java 7 or earlier ), Make sure you don't have method body specified in the interface as interface methods are intrinsically abstract.