This tutorial shows you how to Comment and Uncomment code lines in the Eclipse editor.

How to Comment and uncomment a line in Eclipse Editor?

In Eclipse, Code opened in the Java editor.

It supports two types of comments.

Single-line comments such as //. Multi-Line Comments such as /* */.

Following are ways to comment and uncomment.

In Editor, Select the code that you want to comment on.

  • Open the Source menu
  • Select Toggle Comment to add toggle comments //
  • Select Add Block Comment to add block-level comments /**/
  • Select Remove Block Comment to remove block-level comments /**/

Here are shortcuts

  • To add toggle or single comments //, use Ctrl + / in Windows, and + / in Mac
  • use Ctrl+ Shift + / in Windows, and + Shift + / in Mac to add block level comments
  • Use Ctrl+ Shift + \, and + Shift + \ in Mac to remove block level comments
  • To add javadoc comments, Alt + Shift + J

use Ctrl+ Shift + L to list out all shortcuts.

These shortcuts work on Java, and HTML, XML, and C language code blocks.