What is the / ** code used for in Java language?

18

>, I did not quite understand what that meant, could anyone explain?

    
asked by anonymous 20.02.2014 / 18:05

2 answers

15

To enter comments in the source code, in Java, you can use one of two ways:

// Comentário em uma única linha

/* Comentário
   que se divide em várias
   linhas
 */

When writing comments of the form (note the two asterisks on the first line)

/**
 *
 */

Comments can be interpreted by a tool - called Javadoc - which generates documentation based on the source code using, in addition to the comments between /** */ , other special annotations, such as @author and @date , which provide, respectively, authoring information and the creation date of the file. / p>

The wikipedia article gives you a good idea about Javadoc.

The Java API is an example of documentation generated using the tool.

    
20.02.2014 / 18:10
2

Complementing some tags:

  • {@ code} All text within the keys is not interpreted, including text with HTML markup and Java tags
  • {@ docRoot} contains the root directory of the generated documentation
  • @deprecated indicates that the file or method is deprecated, discontinued, therefore its use is not indicated
  • @exception serves to indicate possible exceptions
  • @throws is used to indicate possible releases
  • {@ link} links to other documentation of some method
  • @param is used to describe parameters
  • {@ value} contains the value of a constant
  • @version specifies the current version of the class or interface
  • @since specifies the version where the method was included
10.06.2017 / 13:37