@Override是java的编译时批注(annotation)语法,
作用是标记哪些是重载父类的方法,哪些是自己新增的方法
并且java编译器在发现有此批注的方法并不是父类的方法时会抛出一个error
并不影响运行时,而且大小写敏感,所以不能写成@override等诸如此类
@Override — the @Override
annotation informs the compiler that
the element is meant to override an
element declared in a superclass
(overriding methods will be discussed
in the the lesson titled "Interfaces
and Inheritance").
// mark method as a superclass method
// that has been overridden
@Override
int overriddenMethod() { }
While it's not required to use this
annotation when overriding a method,
it helps to prevent errors. If a
method marked with @Override fails to
correctly override a method in one of
its superclasses, the compiler
generates an error.