How do I mark method as deprecated? : Annotation « Language Basics « Java
- Java
- Language Basics
- Annotation
How do I mark method as deprecated?
import java.util.Calendar;
import java.util.Date;
public class Main {
public static void main(String[] args) {
getDate();
getMonthFromDate();
}
/**
* Get current system date.
*
* @return current system date.
* @deprecated This method will removed in the near future.
*/
@Deprecated
public static Date getDate() {
return new Date();
}
public static int getMonthFromDate() {
return Calendar.getInstance().get(Calendar.MONTH);
}
}
Related examples in the same category