Built-in Java Annotations Annotation, reflection Reflection

Built-in Java Annotations Annotation

  • @Target: Represents a note can be used in those places
  • @Retention: Represents a note somewhere still valid
  • @Documented: Indicates whether our generation in the javadoc comment
  • @Inherited: a subclass can inherit the parent class notes

Reflection Reflection

Three ways to get the Class class:

  1. Obtained by the object ==> new xxx;. Xxx () getClass ();
  2. == obtained by forname> Class.forName ();
  3. Obtained ==> xxx.class .class class name;

Guess you like

Origin www.cnblogs.com/niudaben/p/11988873.html