Single Line Comments
Comments are lines of code that do not affect how the program runs. Comments contain notes from the programmer, and can be in any format the programmer chooses. These notes make the program clearer and easier to understand. A single line comment can appear anywhere in source code and starts with //. A single line comment ends with the line. You can begin the next line with a single line comment as well. The following is an example of a single line comment.
// this is a comment
If you wanted to, you could also create several lines of comments.
// Comment line 1 // Comment line 2 // Comment line 3
It is always a good idea to add comments to make your program source code easier to understand.
Single line comments can also coexist with regular code, on the same line. Consider the following line of code:
System.out.println("Hello"); // print out "Hello"
As you can see, the left side of the line is actual code, that will execute. The right side of the line, beginning with //, is a comment. Using a single line comment in this way can be useful to explain individual lines of code.




