Interface (Java): Difference between revisions

Content deleted Content added
No edit summary
Line 14:
<source lang="Java">
interface Bounceable {
double pi=3.1415;
void setBounce(); // Note the semicolon
// Interface methods are public, abstract and never final.
Line 19 ⟶ 20:
}
</source>
An interface:
declares only method headers and public constants.
cannot be instantiated.
can be implemented by a class.
cannot extend a class.
can extend several other interfaces.
 
==Usage==