How To Write Good Java Comments. If you don't know what to write, dont. If a comment can't be written in a single line, it should follow the block comment format (see section 5.1.1).

The comments can be used to provide information or explanation about the variable, method, class, or any statement. When the compiler comes across the two forward slashes, it knows that everything to the right of them is to be considered as a comment. If you have more than one paragraph in the doc comment, separate the paragraphs with a