servlets struts hibernate jsf spring maven
 

JAVA 9 Tutorial


@Deprecated annotation was introduced in java five version. A program component annotated with @Deprecated suggests that it mustn't be used for any of the subsequent reasons −

  • Its usage could ends up in errors.
  • It is also incompatible in future version.
  • It is also removed in future version.
  • A higher and economical various has superseeded it.

Compiler generates warnings whenever a deprecated part is used. With Java nine, 2 new enhancements ar created to @Deprecated annotation.

  • forRemoval − Indicates whether or not the annotated part is subject to removal during a future version. The default value is false.
  • since − Returns the version during which the annotated part became deprecated. The default value is that the empty string.

Deprecated with since

Boolean class javadoc on Java 9 illustrate the use of since attribute on @Deprecated annotation.

Deprecated with forRemoval

System class javadoc on Java 9 illustrate the use of forRemoval attribute on @Deprecated annotation.





javacodegeeks is optimized for learning.© javacodegeeks .
All Right Reserved and you agree to have read and accepted our term and condition