what is a abstract method on a interface in java

Marthin picture Marthin · Feb 14, 2012 · Viewed 24.1k times · Source

Possible Duplicate:
Why would one declare a Java interface method as abstract?

I found the following code in one of our ejb interfaces. Does anyone know what the abstract does in the interface? If you do please also explain why it might be needed or provide a reference to read about it =)

@Local
public interface IDomasOrderProcessor {

    public abstract void executeOrderLines(List<OrderLine> lines);
    public abstract void setupJob(List<OrderLine> lines);
    public abstract void setupJob(OrderLine line);
}

Answer

Dev picture Dev · Feb 14, 2012

abstract is redundant in this case. All methods defined on an interface are public and abstract by definition.

Excerpt Java Language Specification section 9.4

Every method declaration in the body of an interface is implicitly abstract, so its body is always represented by a semicolon, not a block.

Every method declaration in the body of an interface is implicitly public.