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