Why is '//' style multiline comment bad (in Java)?

前端 未结 8 1683
甜味超标
甜味超标 2021-02-05 07:15

http://java.sun.com/docs/codeconv/html/CodeConventions.doc4.html#286

I was reading the above section of Java coding convention and started to wonder why it says \"// com

8条回答
  •  隐瞒了意图╮
    2021-02-05 07:45

    I will say that I wouldn't call it "bad". Really, its a matter of convention, which is what others have said. There is nothing inherently bad about it, except that it can make multi-line comments a bit more frustrating (keystrokes-wise) to work with.

    Honestly, I think it is a double standard with javadoc. Javadoc requires:

    /**
     * Validates a chess move. Use {@link #doMove(int, int, int, int)} to move a piece.
     * 
     * @param theFromFile file from which a piece is being moved
     * @param theFromRank rank from which a piece is being moved
     * @param theToFile   file to which a piece is being moved
     * @param theToRank   rank to which a piece is being moved
     * @return            true if the chess move is valid, otherwise false
     */
    

    and I don't understand why the repeated " * " is any better than "//". So, to me, there's nothing inherent about // being bad (because editors can be set up to automatically add them to multi-line comments) and just convention and common practice.

提交回复
热议问题