zoukankan      html  css  js  c++  java
  • 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());
            
        }
    
    }

  • 相关阅读:
    全局数据库名称/数据库实例/SID 的区别
    【转载】ORACLE 10G DBCA创建脚本实现手动创建数据库
    apue 20130328
    apue 20130323
    visual c++6.0
    C语言
    apue 20130322
    apue 20130324
    apue 20130325
    C语言里的字符串解析
  • 原文地址:https://www.cnblogs.com/Hyself/p/7737223.html
Copyright © 2011-2022 走看看