Python知識(shí)分享網(wǎng) - 專業(yè)的Python學(xué)習(xí)網(wǎng)站 學(xué)Python,上Python222
最全Java注解圖文超詳解(建議收藏) PDF 下載
發(fā)布于:2023-11-30 11:00:36
(假如點(diǎn)擊沒反應(yīng),多刷新兩次就OK!)

最全Java注解圖文超詳解(建議收藏) PDF 下載  圖1

 

 

 

 

資料內(nèi)容:

 

1.創(chuàng)建自定義注解
1. /**
2. * 自定義注解例子
3. *
4. * @author mikechen
5. */
6.
7. @Documented
8. @Retention(RetentionPolicy.RUNTIME)
9. @Target(ElementType.METHOD)
10. @Inherited
11. public @interface HelloAnnotation {
12. String value();
13. }
 
2.使用自定義注解
1. /*
2. * 使用自定義注解
3. *
4. * @author mikechen
5. */
6. public class HelloAnnotationClient {
7. @HelloAnnotation(value="Simple custom Annotation example")
8. public void sayHello(){
9. System.out.println("Inside sayHello method..");
10. }
11. }