I know the difference between "public interface" and "public abstract interface", but when applied on methods are there differences?
public interface IPluggableUi {
abstract public JComponent getPanel();
abstract public void initUi();
}
or
public interface IPluggableUi {
public JComponent getPanel();
public void initUi();
}
Methods declared in interfaces are by default both public and abstract.
Yet, one could:
public interface myInterface{
public abstract void myMethod();
}
However, usage of these modifiers is discouraged. So is the abstract modifier applied to the interface declaration.
Particularly, regarding your question:
"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."
source: http://java.sun.com/docs/books/jls/second_edition/html/interfaces.doc.html
Section 9.4: Abstract method declarations.
no, you could also write
public interface IPluggableUi {
JComponent getPanel();
void initUi();
}
its the same thing
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