Java Comments


Java comments are meaningful way to add information, warnings or suggestions about the code which makes the code more readable.

They are ignored by the java compiler.


In Java, there are 2 types of comments:

1. Single Line Comment

Single line comments are used to comment only a single line of code in the program.

Any statement between // and end of line is considered as a comment.

Syntax:

// This is single line comment

2. Multi Line Comment

Multi line comments are used to comment multiple lines of code in the program.

Any statement between /* and */ is considered as a comment.

Syntax:

/*  This is a
    multi line  
    Comment
*/