写一个people类
ID,name,job,work,salary,address
行为:
sound(),run(),work(),show time();
创建两个对象,分别就不同的人。填写进去
people类Java
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- piaoyiren 2022-07-16 11:54关注
import java.util.Date; public class People { private Integer id; private String name; private String job; private String work; private Double salary; private String address; public Integer getId() { return id; } public void setId(Integer id) { this.id = id; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getJob() { return job; } public void setJob(String job) { this.job = job; } public String getWork() { return work; } public void setWork(String work) { this.work = work; } public Double getSalary() { return salary; } public void setSalary(Double salary) { this.salary = salary; } public String getAddress() { return address; } public void setAddress(String address) { this.address = address; } public void sound() { System.out.println(this.name +" is singing"); } public void run() { System.out.println(this.name+" is running"); } public void work() { System.out.println(this.name+" is working"); } public void showTime() { System.out.println(new Date()); } public People(Integer id, String name, String job, String work, Double salary, String address) { super(); this.id = id; this.name = name; this.job = job; this.work = work; this.salary = salary; this.address = address; } public static void main(String[] args) { People p1=new People(1, "zs", "java", "biancheng", 3455.6, "南山"); People p2=new People(2, "lisi", "java", "设计", 3455.6, "南山"); } }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 1无用
悬赏问题
- ¥500 求华为P30PRO手机硬盘数据恢复
- ¥15 关于#vscode#的问题:ESP32开发板对接MQTT实现小灯泡的开关
- ¥15 TMC2209串口模式下读取不到寄存器的值串口助手蓝色字体是发过去的消息,绿色字体是收到的消息,第二行发送读取寄存器的指令但是没有读取到寄存器的值串口助手如下图:接线如下图,如何解决?
- ¥15 高通安卓11提取完整线刷包软件,或者优博讯dt50顺丰刷机包
- ¥20 C,有个译码器,换了信道就跑不出原来数据
- ¥15 MIMIC数据库安装问题
- ¥60 基于JTag协议开发Fpga下载器上位机,哪位大🐂有偿指导?
- ¥20 全书网Java爬取数据
- ¥15 怎么获取红包封面的原始链接,并且获取红包封面序列号
- ¥100 微信小程序跑脚本授权的问题