1,源码
自动生成setter和getter : 单击鼠标右键,选择source,选择Getters and Setters
package com.xiyou.janie.chap1;
public class Student {
private int sno;
private String name;
public Student(int sno, String name) {
// TODO Auto-generated constructor stub
this.sno = sno;
this.name = name;
}
/**
* 获得学生学号 无参 返回当前对象的sno属性值
*/
public int getSno() {
return sno;
}
public void setSno(int sno) {
this.sno = sno;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
/**
* 显示学生的信息 无参 无返回值
*/
public void showInfo() {
System.out.println("sno=" + sno);
System.out.println("name" + name);
}
}
2.加注释
以/**
*
*
*/ 为格式, 写注释,在使用时会看到每个方法的功能以及参数’返回值等
3.打包
选中包,单击鼠标右键-->Export --> java-->jar
4.JavaDoc
如何导出,希望知道的人可以分享一下,谢谢啦