zoukankan      html  css  js  c++  java
  • 10.23创造人第9次作业

    package cn.wzx.www;
    
    public class Person {
        private int id;
        private String name;
        private int age;
        private String sex;
        public String introduce()
        {
            return  "My id=" + id + ", name=" + name + ", age=" + age + ", sex=" +sex ;
        }
        
        public Person(int id,String name,int age,String sex) {
            // TODO 自动生成的构造函数存根
            this.id=id; 
            this.name=name;
            this.age=age;
            this.sex=sex;
        }
        
        public void setId(int id)
        {
            this.id=id;
        }
        
        public void setName(String name)
        {
            this.name=name;
        }
        
        public void setAge(int age)
        {
            this.age=age;
        }
        public void setSex(String sex)
        {
            this.sex=sex;
        }
        public int getId()
        {
            return this.id;
        }
        public String setName()
        {
            return this.name;
        }
        
        public int setAge()
        {
            return this.age;
        }
        public String setSex()
        {
            return this.sex;
        }
        
    }

    package cn.person.www;
     
    public class Demoperson {
     
        public static void main(String[] args) {
            // TODO Auto-generated method stub
            person p1=new person(001,"刘备",40,"北京");
            person p2=new person(002,"关羽",37,"北京");
            person p3=new person(003,"张飞",45,"北京");
            person p4=new person(004,"诸葛亮",25,"北京");
             
            System.out.println(p1.introduce());
            System.out.println(p2.introduce());
            System.out.println(p3.introduce());
            System.out.println(p4.introduce());
             
        }
     
    }
    
    

    
    
  • 相关阅读:
    集合异常原因与处理方式
    List的子类特点
    数据结构:数据的组织方式
    java对多态的了解
    JAVA电话本系统
    字符串转换数组
    登录用户名密码是否合法
    十三 spark 集群测试与基本命令
    十二 flume与kafka数据传输
    十一 spark- Standalone 集群
  • 原文地址:https://www.cnblogs.com/kally004/p/7754369.html
Copyright © 2011-2022 走看看