The difference between these two that the @deprecated is place in the Javadoc comment block while the @Deprecated is placed as a source code element.
package org.kodejava.example.annotation; import java.util.Date; import java.util.Calendar; public class DeprecatedExample { public static void main(String[] args) { DeprecatedExample de = new DeprecatedExample(); de.getDate(); de.getMonthFromDate(); } /** * Get current system date. * * @return current system date. * @deprecated This method will removed in the near future. */ @Deprecated public Date getDate() { return new Date(); } public int getMonthFromDate() { return Calendar.getInstance().get(Calendar.MONTH); } }
Aucun commentaire:
Enregistrer un commentaire