java commenting out of code

Discussion in 'Java' started by patrick, Jan 11, 2006.

  1. patrick

    patrick Guest

    I want to comment out this code in java. How should I do it.? Using
    JBuilder.

    /**
    * bla bla bla
    */
    void method A()
    {
    ....
    }

    All the astisisks have to be got rid of first, then enclose with /* and */
    I find this tedious.especially with big blocks of code.Is there an easier
    way ?

    As a result I normally use // to document my methods.

    TIA
    patrick
     
    patrick, Jan 11, 2006
    #1
    1. Advertising

  2. patrick

    Alan Krueger Guest

    patrick wrote:
    > /**
    > * bla bla bla
    > */
    > void method A()
    > {
    > ...
    > }
    >
    > All the astisisks have to be got rid of first, then enclose with /* and */
    > I find this tedious.especially with big blocks of code.Is there an easier
    > way ?


    If you use // for in-method comments, just comment the method not the
    preceding comment.
     
    Alan Krueger, Jan 11, 2006
    #2
    1. Advertising

  3. patrick

    patrick Guest

    Hmm,

    Still a problem if you want to comment out several methods.
    Also I often find that Ive copied in long methods, from the web say, which
    often use *'s a lot inside the method defimitions.
    patrick

    "Alan Krueger" <> wrote in message
    news:RP7xf.2201$...
    > patrick wrote:
    >> /**
    >> * bla bla bla
    >> */
    >> void method A()
    >> {
    >> ...
    >> }
    >>
    >> All the astisisks have to be got rid of first, then enclose with /* and
    >> */
    >> I find this tedious.especially with big blocks of code.Is there an easier
    >> way ?

    >
    > If you use // for in-method comments, just comment the method not the
    > preceding comment.
     
    patrick, Jan 11, 2006
    #3
  4. Use a good editor, most IDEs have block commenting (i.e. add/remove // in
    front of all selected lines with Ctrl+/ )

    Remon

    "patrick" <> wrote in message
    news:1f8xf.4381$...
    > Hmm,
    >
    > Still a problem if you want to comment out several methods.
    > Also I often find that Ive copied in long methods, from the web say, which
    > often use *'s a lot inside the method defimitions.
    > patrick
    >
    > "Alan Krueger" <> wrote in message
    > news:RP7xf.2201$...
    >> patrick wrote:
    >>> /**
    >>> * bla bla bla
    >>> */
    >>> void method A()
    >>> {
    >>> ...
    >>> }
    >>>
    >>> All the astisisks have to be got rid of first, then enclose with /* and
    >>> */
    >>> I find this tedious.especially with big blocks of code.Is there an
    >>> easier way ?

    >>
    >> If you use // for in-method comments, just comment the method not the
    >> preceding comment.

    >
    >
     
    Remon van Vliet, Jan 11, 2006
    #4
  5. patrick wrote:
    > I want to comment out this code in java. How should I do it.? Using
    > JBuilder.
    >
    > /**
    > * bla bla bla
    > */
    > void method A()
    > {
    > ...
    > }
    >
    > All the astisisks have to be got rid of first, then enclose with /* and */
    > I find this tedious.especially with big blocks of code.Is there an easier
    > way ?
    >
    > As a result I normally use // to document my methods.
    >
    > TIA
    > patrick
    >
    >


    In JDeveloper you just mark the block, then hit alt+u the t. The effect
    is to prepend // to each line in the block.
     
    Malte Christensen, Jan 11, 2006
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?U2FuZHk=?=

    Commenting out VB code

    =?Utf-8?B?U2FuZHk=?=, Feb 2, 2005, in forum: ASP .Net
    Replies:
    5
    Views:
    52,004
    =?Utf-8?B?Sm9uWg==?=
    Feb 3, 2005
  2. Michael

    Commenting out debug code

    Michael, May 27, 2004, in forum: C++
    Replies:
    3
    Views:
    491
  3. Paul McNett

    Re: commenting out blocks of code

    Paul McNett, Feb 18, 2006, in forum: Python
    Replies:
    1
    Views:
    642
    Cameron Laird
    Feb 18, 2006
  4. Peter Hansen

    Re: commenting out blocks of code

    Peter Hansen, Feb 18, 2006, in forum: Python
    Replies:
    8
    Views:
    1,416
    Neil Hodgson
    Feb 20, 2006
  5. Jean-Paul Calderone

    Re: commenting out blocks of code

    Jean-Paul Calderone, Feb 18, 2006, in forum: Python
    Replies:
    0
    Views:
    502
    Jean-Paul Calderone
    Feb 18, 2006
Loading...

Share This Page