Nested comments?
Still a noob with IDEA but checked the archive and really did not find an answer - Is it intentional the way IDEA is handling nested comments? That is it seems not to parse properly and keep track of the number of open and closing /* and */ ??? It seems the only way to get things to work is something like:
/*
start
*/
/* inner comment
*/
/*
end
*/
so basically you need to add another level of comments else IDEA uses the first closing */ it finds to terminate the first /* The "fix", however, is annoying when it comes time to uncomment as one then has to hunt and remove that extra */ and /*
Please sign in to leave a comment.
Yes, that is intentional. IDEA is simply adhering to the Java language specification on comments.
The first highlighted point indicates that */ ends a comment regardless of the text before it (i.e. other comment opening characters). That is further clarified by the second highlighted point that comments do not nest. Try compiling, via javac, a class that has a nested comment. It will fail compiling.
You can nest // comments within a /* */ comment.
Note that if you want to comment out code in IDEA, just select the code block and type Ctrl+/ It will comment out each line with a // comment. Any comments (or either type) are also "commented out".
{Edit} Fixed formatting