How to comment a block in Eclipse?

How to comment a block in Eclipse?

Ctrl/ to toggle // comments and CtrlShift/ to toggle /* */ comments. At least for Java, anyway – other tooling may have different shortcuts.

Ctrl will remove a block of either comment, but wont add comments.

Note: As for Eclipse CDT 4.4.2, CtrlShift/ will not uncomment a /* */ block comment. Use CtrlShift in that case.

EDIT: Its Ctrl on a PC, but on a Mac the shortcuts may all be Cmd instead. I dont have a Mac myself, so cant easily check.

There are two possibilities:

Every line prepended with //

ctrl + / to comment
ctrl + to uncomment

Note: on recent eclipse cdt, ctrl + / is used to toggle comments (and ctrl + has no more effect)

Complete block surrounded with block comments /*

ctrl + shift + / to comment
ctrl + shift + to remove

How to comment a block in Eclipse?

For Eclipse Editor

For Single Line (Toggle Effect)

Comment : Ctrl+Shift+c

Uncomment: Ctrl+Shift+c

For Multiple Lines (Toggle Effect)
(Select the lines you want to comment)

comment : Ctrl+Shift+c

Uncomment: Ctrl+Shift+c

It is for all html , css , jsp , java .
It gives toggle effect.

Leave a Reply

Your email address will not be published.