What is the difference between specifying the abstract keyword on a method of an interface in Java, and not specifying it?
Like:
public void foo();
public abstract void foo();
There is no difference. See the JLS Interfaces - Abstract Method Declatations:
Every method declaration in the body of an interface is implicitly abstract, so its body is always represented by a semicolon, not a block.
Also note:
For compatibility with older versions of the Java platform, it is permitted but discouraged, as a matter of style, to redundantly specify the abstract modifier for methods declared in interfaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With