How do I comment out a section of code?
Author: Deron Eriksson
Description: This tutorial describes how to comment out a section of code in Eclipse.
Tutorial created using: Windows XP || JDK 1.5.0_09 || Eclipse Web Tools Platform 2.0 (Eclipse 3.3.0)
EclipseSW has built-in shortcut keys for commenting out and uncommenting your JavaSW code. I use this all the time during development when I want to turn off a section of code or a method call. Eclipse has the ability to do line comments and block comments.
I'll demonstrate this with the Test class shown here.
First we'll look at adding line comments to a section of code. I start by highlighting the lines of code that I wish to comment out.
Hitting Control-/ comments out the section of code using line comments.
Hitting Control-/ again uncomments the section of code.
(Continued on page 2)