javadoc的使用
  sAAkk3Vxfaa8 2023年11月02日 35 0


一个例子:

运行:


写道


 javadoc -d . Attr.java -encoding utf-8


 

代码:

 

package P1;

/**
 * An <code>Attr</code> object defines an attribute as a
 * name/value pair, where the name is a <code>String</code>
 * and the value an arbitrary <code>Object</code>.
 * 
 * @version 1.1
 * @author Alan
 * @since 1.0
 */
public class Attr {
	/** The attribute name. */
	private final String name;
	/** The attribute value. */
	private Object value = null;
	
	/**
	 * Creates a new attribute with the given name and an
	 * initial value of <code>null</code>.
	 * @see Attr#Attr(String,Object)
	 */
	public Attr(String name) {
		this.name = name;
	}
	
	/**
	 * Creates a new attribute with the given name and
	 * initial value.
	 * @see Attr#Attr(String)
	 */
	public Attr(String name, Object value) {
		this.name = name;
		this.value = value;
	}
	
	/** Returns this attribute's value. */
	public Object getValue() {
		return value;
	}
	
	/**
	 * Sets the value of this attribute . Changes the 
	 * value returned by calls to {@link #getValue()}.
	 * @param newValue	The new value for the attribute.
	 * @return	The original value.
	 * @see #getValue()
	 */
	public Object setValue(Object newValue) {
		Object oldVal = value;
		value = newValue;
		return oldVal;
	}
	
	/**
	 * Returns a string of the form <code>name=value</code>.
	 */
	public String toString() {
		return name + "='" + value + "'";
	}

}

 

 

另外:eclipse中可以只用导出javadoc。

 


写道


使用eclipse生成文档(javadoc)主要有三种方法:
1,在项目列表中按右键,选择Export(导出),然后在Export(导出)对话框中选择java下的javadoc,提交到下一步。
在Javadoc Generation对话框中有两个地方要注意的:
javadoc command:应该选择jdk的bin/javadoc.exe
destination:为生成文档的保存路径,可自由选择。
按finish(完成)提交即可开始生成文档。
2,用菜单选择:File->Export(文件->导出),
剩下的步骤和第一种方法是一样的。
3,选中要生成文档的项目,然后用菜单选择,
Project->Generate Javadoc直接进入Javadoc Generation对话框,剩余的步骤就和第一种方法在Javadoc Generation对话框开始是一样的。


 

【版权声明】本文内容来自摩杜云社区用户原创、第三方投稿、转载,内容版权归原作者所有。本网站的目的在于传递更多信息,不拥有版权,亦不承担相应法律责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@moduyun.com

  1. 分享:
最后一次编辑于 2023年11月08日 0

暂无评论

推荐阅读
sAAkk3Vxfaa8