Comments
christian.dinh2476 total contributions
Published May 6, 2021Updated Sep 9, 2021
Contribute to Docs
A comment is a piece of text within a program that is not executed. It can be used to provide additional information to aid in understanding the code.
Single-line Comments
In Java, single-line comments are created with two consecutive forward slashes //
.
// I am a single-line comment!System.out.println('Hello, world!');
A single-line comment can also be used to comment after a line of code:
System.out.println('Hello, world!'); // Me, too!
Multi-line Comments
Multi-line comments are created by surrounding the lines with /*
at the beginning and */
at the end. Comments are good ways for a variety of reasons like explaining a code block or indicating some hints, etc.
/*And I am amulti-line comment!*/
All contributors
- christian.dinh2476 total contributions
- Anonymous contributorAnonymous contributor3071 total contributions
- christian.dinh
- Anonymous contributor
Looking to contribute?
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.