Section 1.1: Interfaces in Java
In Java, an interface specifies one or more methods. The interface is a contract which must be honored by all implementing classes. The interface defined in Listing 1-1 specifies methods method1 and method2.
interface I1
{
void method1();
String method2(String x);
}
Listing 1-1
I1.java
Any class that implements an interface must provide implementations for all the methods declared in the interface (or the class must be declared as abstract). Since the class defined in Listing 1-2 provides implementations for both method1 and method2, objects of class ...