javadoc的使用

一个例子:

运行:

写道
 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对话框开始是一样的。

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值