Java Tips for Beginners (4): comment out multiple lines

Eclipse allows us to use “Ctrl + / “to comment multiple lines with “//” after highlighting them. Press “Ctrl + / ” again to uncomment.

“Ctrl + Shift + / ” will comment multiple lines with “/*     */”. Use “Ctrl + Shift + \ ” to uncomment.

Some people suggest that “/* */ does not nest and can cause errors”, so it’s better to use just “//” on each line.

References:

(1) Tutorial: http://avajava.com/tutorials/lessons/how-do-i-comment-out-a-section-of-code.html

(2) StackOverflow: http://stackoverflow.com/questions/2449304/in-java-what-is-the-syntax-for-commenting-out-multiple-lines

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s