In Java what is the syntax for commenting out multiple lines?
I want to do something like:
(comment)
LINES I WANT COMMENTED
LINES I WANT COMMENTED
LINES I WANT COMMENTED
(/comment)
/* */ (multiline comment)
By convention, in Java, documentation comments are set inside the comment delimiters /** ... */ with one comment per class, interface, or member. The comment should appear right before the declaration of the class, interface or member and each line of the comment should begin with a "*".
/** and /* in Java comments All characters available inside any comment are ignored by Java compiler. /** is known as documentation comments. It is used by Javadoc tool while creating the documentation for the program code. /* is used for multi-line comments.
/*
LINES I WANT COMMENTED
LINES I WANT COMMENTED
LINES I WANT COMMENTED
*/
/*
Lines to be commented
*/
NB: multiline comments like this DO NOT NEST. This can be the source of errors. It is generally better to just comment every line with //. Most IDEs allow you to do this quite simply.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With