that objects of that type can somehow be sorted. For example: interface Bounceable { double pi = 3.1415; void setBounce(); // Note the semicolon // Interface methods are public, abstract and never final. // Think of them as prototypes only; no implementations are allowed. } 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 Defining an interface Interfaces are defined with the following syntax (compare to Java's class definition): [visibility] interface InterfaceName [extends other interfaces] { constant declarations abstract method declarations static method declarations } Example: public interface Interface1 extends Interface2; The body of the interface contains abstract methods, but since all methods in an interface are, by definition, abstract, the abstract keyword is not required. Since the interface specifies a set of exposed behaviors, all methods are implicitly public. Thus, a simple interface may be public interface Predator { boolean chasePrey(Prey p); void eatPrey(Prey p); } The member type declarations in an interface are implicitly static, final and public, but otherwise they can be any type of class or interface.'Implementing interfaces in a class The syntax for implementing an interface uses this formula: ... implements InterfaceName[, another interface, another'', ...] ... Classes may implement an interface. For example: public class Lion implements Predator { @Override public boolean chasePrey(Prey p) { // Programming to chase prey p (specifically for a lion) } @Override public void eatPrey(Prey p) { // Programming to eat prey p (specifically for a lion) } } If a class implements an interface and does not implement all its methods, it must be marked as abstract. If a class is abstract, one of its subclasses is expected to implement its unimplemented methods, though if any of the abstract class' subclasses do not implement all interface methods, the subclass itself must be marked again as abstract. Classes can implement multiple interfaces: public class Frog implements Predator, Prey { ... } Interfaces can share common class methods: class Animal implements LikesFood, LikesWater { boolean likes() { return true; } } However a given class cannot implement the same or a similar interface multiple times: class Animal implements Shares<Boolean>, Shares<Integer> ... // Error: repeated interface Interfaces are commonly used in the Java language for callbacks, as Java does not allow multiple inheritance of classes, nor does it allow the passing of