package com.atguigu.exercise;
public class PersonTest {
public static void main(String[] args) {
Person b = new Person();
// b.getAge();
b.setAge(12);
}
}
class Person{
private int age;
public void setAge(int a){
if(a<0 || a>130){
System.out.println("输入的数据非法");
}else{
age = a;
}
System.out.println("年龄为:"+ age);
}
public int getAge(){
return age;
}