• Java 2017.10.23 杨浩宁作业


    package top.hyself;
    
    public class Test_1023 {
        private int id;
        private String name;
        private int sex;
        private int age;
        private String city;
    
    
        public Test_1023(int id,String name,int sex,int age,String city) {
            this.id = id;
            this.name = name;
            this.sex = sex;
            this.age = age;
            this.city = city;
        }
        
        
        public int getId() {
            return id;
        }
        public void setId(int a) {
            this.id = a;
        }
        
        public String getName() {
            return name;
        }
        public void setName(String a) {
            this.name = a;
        }
        
        public int getSex() {
            return sex;
        }
        public void setSex(int a) {
            this.sex = a;
        }
        
        public int getAge() {
            return  age;
        }
        public void setAge(int a) {
            this.age = a;
        }
        
        public String getCity() {
            return  city;
        }
        public void setCity(String a) {
            this.city = a;
        }
    }
    package top.hyself;
    
    public class Birth {
    
        public static void main(String[] args) {
            Test_1023 human1 = new Test_1023(100001,"Fitz",1,26,"北京");
            Test_1023 human2 = new Test_1023(100002,"Simmons",0,25,"北京");
            Test_1023 human3 = new Test_1023(100003,"Ward",1,28,"天津");
            Test_1023 human4 = new Test_1023(100004,"Daisy",0,21,"上海");
            print(human1);print(human2);print(human3);print(human4);    
        }
    
    
    
        public static void print(Test_1023 x) {
            // TODO Auto-generated method stub
            String sex;
            if(x.getSex() == 1)
                sex = "男";
            else sex = "女";
            
            System.out.println("id:" + x.getId() +",name:" + x.getName() + ",sex:" + sex + ",age:" 
            + x.getAge() + ",city:" + x.getCity());
            
        }
    
    }

  • 相关阅读:
    「CSP-S2020」贪吃蛇
    CSP-S 2020 游记
    「POI2012」Leveling Ground
    「THUPC2019」鸭棋
    「SNOI2020」取石子 题解
    第一篇随笔
    实验三 面向对象分析与设计
    高斯模型
    实验二 结构化分析与设计
    极大似然估计
  • 原文地址:https://www.cnblogs.com/Hyself/p/7737223.html
Copyright © 2020-2023  润新知