- These three notes are to provide information to the compiler
- @Override
1. Role:
@Target (value = the METHOD)
@Retention (the SOURCE = value)
public @interface Override represents a declaration is intended to override a superclass method as another method declaration. If you use this method to annotate annotation type but does not override the superclass method, the compiler generates an error message.
2. Parent Class:
public class A {
public void st0() {
}
}
3. subclasses:
public class B the extends A {
// here does not override the parent class, because the 0 as o, but the compiler does not know what you have to do, so we have to tell the compiler,
the compiler will really help me to check if covered
@override
public void STO () {
}
}
4. Effects:
- @Deprecated
1. Role:
Retention of Documented @ @ (value = RUNTIME) public @interface of Deprecated in
with @Deprecated program elements comments, do not encourage programmers to use such elements, typically because
it is dangerous or there is a better choice. In using the program elements are not in favor or not in favor of the code
is executed to rewrite the compiler will issue a warning.
2. Class:
public class A {
// wood not obsolete write
public void test1 () {
}
@Deprecated
public void test2 () {
}
}
3. Use:
- @SuppressWarnings
Role: indication should be removed to display the specified compiler in the annotated element (and in all program elements contained in the annotated element) warning
1. Use : For example, we dated, we do not want to see the warning, with the notes to complete: