Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

annotation = comment?

do they by annotation mean a comment in a code with // or /* */?

like image 996
ajsie Avatar asked Jan 10 '10 12:01

ajsie


People also ask

What is the difference between annotation and comments?

is that annotation is a critical or explanatory commentary or analysis while comments is . ( comment ). Other Comparisons: What's the difference?

What is the meaning of annotation?

Definition of annotation. 1: a note added by way of comment or explanation The bibliography was provided with helpful annotations. 2: the act of annotating something.

Are @annotations included in ‘Javadoc comments’?

Annotations are not included in ‘Javadoc’ comments. The use of @Documented annotation in the code enables tools like Javadoc to process it and include the annotation type information in the generated document. It is designed to be used only as an annotation to another annotation.

What is @documented annotation in Java?

It is a marker interface that tells a tool that an annotation is to be documented. Annotations are not included in ‘Javadoc’ comments. The use of @Documented annotation in the code enables tools like Javadoc to process it and include the annotation type information in the generated document.


1 Answers

No, an annotation is not a comment. An annotation is added to a field, class or method, using the syntax @Annotation. One of the best known annotations is @Override, used to signal a method is overriding one from a super class. For example:

public class MyClass {
  @Override
  public boolean equals(Object other) {
    //...
  }
}

See http://download.oracle.com/javase/1,5.0/docs/guide/language/annotations.html for more info.

like image 138
Jorn Avatar answered Oct 13 '22 01:10

Jorn