| |
1. 14. 3. 标准说明:过时 |
|
Deprecated is a marker annotation type that can be applied to a method or a type (class/interface) to indicate that the method or type is deprecated.
Deprecating a method: |
public class DeprecatedTest {
@Deprecated
public void serve() {
}
}
|
|
If you use or override a deprecated method, you will get a warning at compile time. |
public class DeprecatedTest2 {
public static void main(String[] args) {
DeprecatedTest test = new DeprecatedTest();
test.serve();
}
}
class DeprecatedTest {
@Deprecated
public void serve() {
}
}
|
|
|