a) 编写一个员工类Employee,属性有:
答案:1 悬赏:30 手机版
解决时间 2021-11-08 07:02
- 提问者网友:贪了杯
- 2021-11-07 16:34
a) 编写一个员工类Employee,属性有:
最佳答案
- 五星知识达人网友:毛毛
- 2021-11-07 16:39
public class Employee { private long id; private String name; private int age; private boolean sex; private String phone; public Employee(long id, String name,int age, boolean sex, String phone ) { this.id = id; this.name = name; this.age = age; this.sex = sex; this.phone = phone; } public int getAge() { return age; } public String getSex() { if (sex) { return "女"; } return "男"; } public long getPhone() { return phone; } public static void main(String[] args) { Employee emplyee = new Employee(1, "张三", 18, "男", 65534568) System.out.println(emplyee.getAge()); System.out.println(emplyee.getSex()); System.out.println(emplyee.getPhone()); }
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯