static方法成员

来源:互联网 发布:淘宝一分钱秒杀怎么买 编辑:程序博客网 时间:2024/05/16 07:56

class person{
    String name;
    int age;
    static String country;
    public person(){}
    public person(String name,int age){
        this.name=name;
        this.age=age;

    }
     public person(String name,int age,String country){
        this.name=name;
        this.age=age;
        this.country=country;

    }
    public void show(){
        System.out.println("姓名是:"+name+"年龄"+age+"国家"+country);

    }

}
class persontest{
    public static void main(String [] args){
        person p1=new person("大致",11,"中国");
        p1.show();
        person p2=new person("小明",11);
        p2.show();
        person p3=new person("小刚",11);
        p3.show();


    }


}




0 0
原创粉丝点击