添加员工信息

添加员工信息,第1张

添加员工信息

public class Employee {

    private String name;//姓名

    private int id;//员工号

    private int num;//员工数

    public Employee() {//无参构造

    }

    public Employee(String name, int id, int num) {//有参构造器

        this.name = name;

        this.id = id;

        this.num = num;

    }

    //下面是属性的get set方法

    public String getName() {

        return name;

    }

    public void setName(String name) {

        this.name = name;

    }

    public int getId() {

        return id;

    }

    public void setId(int id) {

        this.id = id;

    }

    public int getNum() {

     return num;

    }

    public void setNum(int num) {

        this.num = num; }   

}

java 定义一个公司员工类属性有姓名,员工号,和员工对象个数。有俩个构造方法(无参构造方法,为姓名、员工号、和部门赋值的构造方法)、获取和设置各属性的方法及获取当前员工对象个数的方法。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5684249.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-17
下一篇 2022-12-17

发表评论

登录后才能评论

评论列表(0条)

保存