There are several reasons for a method not to have a method body:
UnsupportedOperationException
should be thrown. public void doSomething() { } public void doSomethingElse() { }
@Override public void doSomething() { // Do nothing because of X and Y. } @Override public void doSomethingElse() { throw new UnsupportedOperationException(); }
Default (no-argument) constructors are ignored when there are other constructors in the class, as are empty methods in abstract classes.
public abstract class Animal { void speak() { // default implementation ignored } }