In Java, when should I use an abstract method in an interface?

abstract-methods, coding-style, interface, java

Solution

There isn't any functional difference. No implementation is ever provided in a java interface so all method declarations are implicitly abstract.

See [1]: http://java.sun.com/docs/books/tutorial/java/IandI/abstract.html

A direct quote form the above:

Note: All of the methods in an interface (see the Interfaces section) are implicitly abstract, so the abstract modifier is not used with interface methods (it could be—it's just not necessary).

Problem

I have the following interface in Java ``` public interface IFoo { public abstract void foo(); public void bar(); } ``` What is the difference between foo() and bar()? When should I use abstract? Both seem to accomplish what I want unless I'm missing something subtle? Update Duplicate of Why would one declare a Java interface method as abstract?

Original source

Related problems