A comment is text you want Java to ignore. Comments allow you to describe code or keep notes.
By using comments in the Java code, you may help yourself and even other programmers understand the purpose of code that a comment refers to.
In Java, there are two styles of comments: single line comments and multi-line comments.
- Single line comments are one line comments that begin with two forward slashes:
- Multi-line comments are generally longer comments that can span multiple lines. They begin with
/* and end with
*/ . Here's an example: