首页 > 代码库 > people 0919
people 0919
package liu0919;public class People{ private double height;// 身高 private String name;// 名字 private int age;//年龄 private String sex;//性别 //成员方法 public double getHeight() { return height; } public void setHeight(double height) { this.height = height; } public String getName() { return name; } public void setName(String name) { this.name = name; } public int getAge() { return age; } public void setAge(int age) { this.age = age; } public String getSex() { return sex; } public void setSex(String sex) { this.sex = sex; } public String xingwei(String xw) { return xw; } public int Jia(int a,int b) { return a+b; } public String Gaiming(String gm) { return gm; }}
package liu0919;public class Cishi_people { public static void main(String[] args) { People pe=new People(); pe.setName("张三"); System.out.println("姓名是:"+pe.getName()); pe.setSex("男"); System.out.println("性别是:"+pe.getSex()); pe.setAge(18); System.out.println("年龄是:"+pe.getAge()); pe.setHeight(1.80); System.out.println("身高是:"+pe.getHeight()); System.out.println("说出:"+pe.xingwei("你好!")); System.out.println("23+45="+pe.Jia(23, 45)); System.out.println("姓名改为:"+pe.Gaiming("李四")); }}
people 0919
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。