Previous | Next | Trail Map | Learning the Java Language | More Features of the Java Language

Implementing the Sleeper Interface

Implementing an Interface in the previous lesson already showed you how to implement an interface. Here, the GUIClock class implements one interface--Sleeper:
public class GUIClock extends Applet implements Sleeper {
    . . .
    public void wakeUp() {
        // update the display
    }
}
Remember that when a class implements an interface, it is essentially signing a contract. The class must provide method implementations for all of the methods declared in the interface and its superinterfaces. Or, the class must be declared abstract. The method signature (the name and the number and type of arguments) for the method in the class must match the method signature as it appears in the interface.


Previous | Next | Trail Map | Learning the Java Language | More Features of the Java Language