1、private:只能在本类访问
2、默认值:只能在本类或者同一个包下访问
3、protected:只能在本类、同包、子类中访问
4、public:在任意位置都能访问
private int id;
String name;
protected int age;
public int weight;
1、private:只能在本类访问
2、默认值:只能在本类或者同一个包下访问
3、protected:只能在本类、同包、子类中访问
4、public:在任意位置都能访问
private int id;
String name;
protected int age;
public int weight;