zoukankan      html  css  js  c++  java
  • 10.23创造人

    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.wzx.www;
    
    public class DemoPerson {
    
        public static void main(String[] args) {
            // TODO 自动生成的方法存根
            Person p1=new Person(163600,"张三",20,"男");
            Person p2=new Person(163600,"李四",30,"男");
            Person p3=new Person(163600,"王二麻子",40,"男");
            Person p4=new Person(163600,"陈八婆",50,"女");
            p1.setAge(40);
            shuchu(p1.introduce());
            shuchu(p2.introduce());
            shuchu(p3.introduce());
            shuchu(p4.introduce());
        }
        
        public static void shuchu(String vhat)
        {
            System.out.println(vhat);
        }
    
    }

  • 相关阅读:
    Rain 学习自用贴
    連休計画
    091207 晴
    记下London奥运我喜欢的几首歌
    20世纪最好的10个算法(转)
    一日一美女:告诉你什么是斐波那契螺旋线
    矩阵鞍点的寻找
    日本の物語
    a new start~ s!
    Photoshop CS5运用色彩原理去除半透明水印(转)
  • 原文地址:https://www.cnblogs.com/jasonzj/p/7726022.html
Copyright © 2011-2022 走看看