文档注释的正文并不是直接复制到输出文件 (文档的 HTML 文件),而是读取每一行后,删掉前导的 * 号及 * 号以前的空格,再输入到文档的。如:
       /**
        * This is first line. <br>
        ***** This is second line. <br>
       This is third line.
       */
编译输出后的HTML源码则是:
       This is first line. <br>
       This is second line. <br>
       This is third line.
/** commnet for class */是对 class Test 的说明,把它放在public class Test { ...... }之前时,其后紧接着 class Test,符合规则,所以生成的文档正确。但是把它和“import java.lang.*;调换了位置后,其后紧接的就是不 class Test 了,而是一个 import 语句。由于文档注释只能说明类、属性和方法,import
语句不在此列,所以这个文档注释就被当作错误说明省略掉了。
<br>
public class Test extends Button { <br>
/**
* Constructor description goes here.
* @param name
* The more description.
*
*/<br>
public Test(String name){
……
}
} 3. **方法注释**
<br> 例如
public class Test extends Button {
/**
* Fuction description goes here.
* @param color
* @return void
* @exception (If needed)
* @author Administrator
* @date 2016/6/29
*
*/
public voidaddColor(String color){
/* * @(#)Blah.java 1.82 99/03/18 * * Copyright (c) 1994-1999 Sun Microsystems, Inc.
901 San Antonio * Road, Palo Alto, California, 94303, U.S.A.All rights reserved. <br>*<br> * This software is the confidential and proprietary information of Sun * Microsystems, Inc. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with Sun.
*/
package java.blah;
import java.blah.blahdy.BlahBlah;
/** * Class description goes here. * @version 1.82 18 Mar 1999 * @author Firstname Lastname *
*/
public class Blah extends SomeClass {
...
}