Possible duplicate:Why declare a Java interface method abstract?
I found the following code in one of our ejb interfaces. Does anyone know what abstraction in an interface does? If you do, please explain why this may be required or provide a link 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); }
abstract is redundant in this case. All methods defined on an interface are public and abstract by definition.
abstract
interface
public
Excerpt Section "Java Language Specification" 9.4
Each method declaration in an interface body is implicitly abstract, so its body is always represented by a semicolon, not a block.Each method declaration in the body of the interface is implicitly public.
Each method declaration in an interface body is implicitly abstract, so its body is always represented by a semicolon, not a block.
Each method declaration in the body of the interface is implicitly public.
Both the public and abstract modifiers are implicit in the interfaces and should be avoided.
A method in an interface is public and abstract by definition. I heard that some people say that they feel that their explicit announcement makes them clearer, but to me it seems like an extra noise.
According to this document, all interface methods are public and abstract , so it makes no sense to explicitly define the abstract method inside the interface .