Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Is there a shortcut for multi line comment?

I know the shortcut for the single line comment, command + /, but I would like to know the shortcut for the multi line comment if there is any. Thanks!

3 Answers

I'm pretty sure.

In most text editors, you can just select a whole block of code my using your mouse, then you can press Cmmd+/, and all the code will turn into a comment. Of course, you can un-comment it by doing the same steps.

Thanks both of you!

Jonas Gamburg
Jonas Gamburg
11,193 Points

I believe you're looking for something like this: (in Eclipse)

For single line comment you can use Ctrl + / and for multiple line comment you can use Ctrl + Shift + / after selecting the lines you want to comment in java editor.

On Mac/OS X you can use ⌘ + / to comment out single lines or selected blocks.

Source: http://stackoverflow.com/questions/5534748/eclipse-comment-uncomment-shortcut