• 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);
        }
    
    }

  • 相关阅读:
    C# XmlSerializer实现序列化浅析(转载)
    Direct3D学习(资料收集)
    幸福法则
    javascript中的keydown事件中的参数问题
    去除UTF8 BOM【转】
    JavaScript常用资料参考
    KCFinder CKEditor的文件管理器插件
    elFinder Web文件管理器
    用TcpTrace调试Web服务器
    Ubuntu 12.04如何登入root?
  • 原文地址:https://www.cnblogs.com/jasonzj/p/7726022.html
Copyright © 2020-2023  润新知