Sleeper是接口,
类GUIClock实现了此接口,实现接口的关键字是implements在函数wakeUp()后面写了“实现接口的方法",这是一个注脚,使程序更加好理解。
如果一个类实现了一个接口,那么如果这个类不是抽象类,那么,在接口的文法都要在此类中实现。

解决方案 »

  1.   

    In a sense, 接口就是一个函数的定义. The definition or called signature of a method is the return type, the name of the method, the parameters of the method.
    when a class extends another class, the sub class has to implements all the abstract methods of the super class.
    And/or, when a class implements an interface, the class has to implements all defined methods in the interface.
    That is called实现接口。
    wakeUp() 一定是interface Sleeper里的定义的一个函数名。区看看Sleeper的代码吧。