Java Comments
Java Comments
Comments in any programming language are ignored by the compiler or the interpreter. A comment is a part of the coding file that the programmer does not want to execute, rather the programmer uses it to either explain a block of code or to avoid the execution of a specific part of code while testing.
There are two types of coments:
- Single-line comment
- Multi-line comment
A. Single Line Comments:
To write a single-line comment just add a ‘//’ at the start of the line.
Example:
Output:
B. Multi Line Comments:
To write a multi-line comment just add a ‘/*…….*/’ at the start of the line.
Example:
Output: