Java: Comment Syntax

By Xah Lee. Date: . Last updated: .

Line Comment

comments are ignored.

// this a comment, to end of line

// another comment. yes

Block Comment

/*
block comment syntax.
can be multiple lines.

Useful for commenting out a block of code.
*/

Block Comment Cannot be Nested

/*
block comment cannot be nested
/*
this is syntax error
*/
*/