Review of Interfaces and AICs

Review 3 Types of Interfaces in Java


  1. Marker Interfaces (zero abstract methods)

  2. Regular Interfaces

  3. SAM Interface now called Functional Interface

Also note that starting in Java version 8, non-abstract methods called default methods can now also be defined in an interface in java.

Example of Marker Interface: Serializable


Example of a Regular Interface

Interface Bicycle {

void go();

void shift(int gear);

int stop();

}

Example of Functional Interface: Comparator

Review of Annonymous Inner Class