in java what does the @ symbol mean?

后端 未结 6 1363
后悔当初
后悔当初 2020-12-13 08:12

I know what it means in a comment for documentation purposes, but outside of that what does it mean? (I would normally just google this but every non letter symbol shows up

6条回答
  •  醉梦人生
    2020-12-13 09:00

    The @ symbol is used for annotations. In my experience, the most common annotation is @Override, which indicates that a method is declared in a superclass. Other common annotations are @Deprecated, indicating that a method should no longer be used but still exists for backwards compatibility, and @SupressWarnings, to prevent warnings from showing up in the compiler.

    Note that it's actually possible to get annotations which are not included in the core Java libraries and to declare your own annotations.

提交回复
热议问题