How do annotations like @Override work internally in Java?

前端 未结 6 862
粉色の甜心
粉色の甜心 2020-12-02 03:56

Can anybody explain to me how annotations work internally in java?

I know how we can create custom annotations by using java.lang.annotation library in java. But I s

6条回答
  •  时光取名叫无心
    2020-12-02 04:28

    Here's @Override: http://www.docjar.com/html/api/java/lang/Override.java.html.

    There's nothing special about it that differentiates it from an annotation you might write yourself. The interesting bits are in the consumers of the annotations. For an annotation like @Override, that would be in the Java compiler itself, or a static code analysis tool, or your IDE.

提交回复
热议问题