本帖最后由 ysuliu 于 2014-01-11 09:49:56 编辑

解决方案 »

  1.   

    你的理解错误吧,要么就是翻译的不准确。
    我一般都喜欢用这种注释/*
    func(){
    }
    //*/因为我只需要在注释的第一行前面加一个/,则可以取消注释,再把/去掉,就可以注释很多行。
      

  2.   

    没见过 这种写法 ,你可以写上多少也多少行 大家一块看看,java编程思想这本书大多数人都有
      

  3.   

    我学习java那么久,没有见过这样的注释~~
      

  4.   

    貌似没有这种注释吧,java就三种注释,单行,多行,帮助文档.
      

  5.   

    Java 编程思想 中文版 第四版 46页,第二行就是。。
    章节是:3.8 逻辑操作符从这一页开始,后面很多的示例代码都使用了这种注释方式。。
      

  6.   

    没仔细读过 Java编程思想 吧
    书里面用得很多,我也不知道什么意思。。
      

  7.   


    看了一下确实如此,以前对thinking java 这写前几章没认真看过,没注意到这个写法,查了些
    java语言规范地址,java7中3.7是注释的描述如下,也没有这种写法。3.7. CommentsThere are two kinds of comments./* text */A traditional comment: all the text from the ASCII characters /* to the ASCII characters */ is ignored (as in C and C++).// textAn end-of-line comment: all the text from the ASCII characters // to the end of the line is ignored (as in C++).
    Comment:
        TraditionalComment
        EndOfLineCommentTraditionalComment:
        / * CommentTailEndOfLineComment:
        / / CharactersInLineoptCommentTail:
        * CommentTailStar
        NotStar CommentTailCommentTailStar:
        /
        * CommentTailStar
        NotStarNotSlash CommentTailNotStar:
        InputCharacter but not *
        LineTerminatorNotStarNotSlash:
        InputCharacter but not * or /
        LineTerminatorCharactersInLine:
        InputCharacter
        CharactersInLine InputCharacter
    These productions imply all of the following properties:Comments do not nest./* and */ have no special meaning in comments that begin with //.// has no special meaning in comments that begin with /* or /**.As a result, the text:/* this comment /* // /** ends here: */
    is a single complete comment.The lexical grammar implies that comments do not occur within character literals (§3.10.4) or string literals (§3.10.5).也无从查处,个人猜测跟当时作者的编辑器有关,如果用eclipse的话就不会这么麻烦,直接ctrl+/就可以了。
      

  8.   


    看了一下确实如此,以前对thinking java 这写前几章没认真看过,没注意到这个写法,查了些
    java语言规范地址,java7中3.7是注释的描述如下,也没有这种写法。3.7. CommentsThere are two kinds of comments./* text */A traditional comment: all the text from the ASCII characters /* to the ASCII characters */ is ignored (as in C and C++).// textAn end-of-line comment: all the text from the ASCII characters // to the end of the line is ignored (as in C++).
    Comment:
        TraditionalComment
        EndOfLineCommentTraditionalComment:
        / * CommentTailEndOfLineComment:
        / / CharactersInLineoptCommentTail:
        * CommentTailStar
        NotStar CommentTailCommentTailStar:
        /
        * CommentTailStar
        NotStarNotSlash CommentTailNotStar:
        InputCharacter but not *
        LineTerminatorNotStarNotSlash:
        InputCharacter but not * or /
        LineTerminatorCharactersInLine:
        InputCharacter
        CharactersInLine InputCharacter
    These productions imply all of the following properties:Comments do not nest./* and */ have no special meaning in comments that begin with //.// has no special meaning in comments that begin with /* or /**.As a result, the text:/* this comment /* // /** ends here: */
    is a single complete comment.The lexical grammar implies that comments do not occur within character literals (§3.10.4) or string literals (§3.10.5).也无从查处,个人猜测跟当时作者的编辑器有关,如果用eclipse的话就不会这么麻烦,直接ctrl+/就可以了。无所谓了,貌似不是什么重要的功能。。只是偶然看到了,觉得很奇怪,Google & Baidu都没搜到。。
    估计可能是当时作者的特殊习惯:)
      

  9.   

    我来给个上下文吧:逻辑操作符
    int i = rand.nextInt(100);
    int j = rand.nextInt(100);
    ...
    print("i != j is " + (i != j));
    // Treating an int as a boolean is not legal Java:
    //! print("i && j is " + (i && j));
    //! print("i || j is " + (i || j));
    //! print("!i is " + !i);
    print("(i < 10) && (j < 10) is" + ((i < 10) && (j < 10)));
    ...
    “与”、“或”、“非”操作只可应用于布尔值。与在C及C++中不同的是:不可将一个非布尔值当作布尔值在逻辑表达式中使用。在前面的代码中用//!注释掉的语句,就是错误的用法(这种注释语句使得注释能够被自动移除以方便测试)。所以我的理解就是:
    1、作者用//!来提醒读者,这语句是错误的;
    2、在代码中“注释代码”/“移除注释”,可以很方便的测试代码正确与否。