In this lesson, we are going to see the comments in the code. All in the code we can put some comments to explain what is doing the programm at any time. The comments can be line by line(//), or multiple lines(/* */).
Here is an example:
//comment in a single line
/* closed comment in a single line */
/**
* comment in multiple lines
*/
The comments of multiple lines can also be closed in the same line, letting write more code following the comment. Another type of comments are the JavaDoc (/** */). Those comments are used to introduce a class, method or variable that can be seen in an IDE when you are writting some code. Here is an example of a JavaDoc for a method:
/**
* Description of the method
* @param value Description of the argument named value
* @return Description of the returned value
*/
public int setVariable(int value){
//something
return x;
}
No comments:
Post a Comment