Documentation
The comments created using /**
differ from the ones that use /*
because they are interpreted by Javadoc. It is a tool used to generate documentation in HTML format. These special comments are used by Javadoc to create the documentation of our classes. We can add tags with the @
sign. They suggest, e.g., what parameters a method takes or what it returns. We can also use HTML tags. To generate a Javadoc document in IntelliJ Idea, we go to Tools / Generate JavaDoc...
.
/**
* The object <code>obj</code> represents an object.
*
* @author CPUcademy
* @version 1.0.1
*/
public class Main {
/**
* @param args
*/
public static void main(String[] args) {
/**
* This is the main method.
*/
}
/**
* @param x
* @return x
*/
public int method(int x){return x;}
}