package _02_private;

public class Student {
    private String name;
    private int age;

    public String getName(){
        return name;
    }

    public void setName(String n){
        name = n;
    }

    public void setAge(int a){
        if(a > 0 && a<=100){
            age = a;
        }else{
            System.out.println("年龄不合法");
        }
    }
    public int getAge(){
        return age;
    }

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