Comp 110 Code Commenting

A quick tutorial on Java Comments

Source code files can contain annotations, called comments, that add english commentary to your program's code. These comments are for humans only. Java happily ignores everything you place in a comment. Therefore, comments are used when adding the required header documentation to your projects before submission.

In Java, there are two kinds of comments. The first kind begins with two forward slashes and ends when the line ends:

// Single line comments end at the end of the line of code

The second kind, block comments, are enclosed by a matching set of /* and */. Everything between the symbols is a comment.

/* Block comments end with a * and a / one after the other: */

Since block comments can span multiple lines, use them for adding your assignment headers.

/* Block 
 * comments 
 * can
 * span
 * many
 * lines