Object
Here is an example interface definition:
interface MyInterface { public final int aConstant = 32; // a constant public final double pi = 3.14159; // a constant public void methodA( int x ); // a method declaration double methodB(); // a method declaration }
The constants don't have to be
separated from the methods, but doing so makes the interface easier to read.
A method in an interface cannot be made private
.
A method in an intervace is public
by default.
In the example methodB
is public
even though it
does not say so.
public
(this happens by default).