代码01
public class permissionsDemo {
/*
权限修饰符 :
private: 同一个类中
(default):同一个类中,同一个包中 //没有修饰前缀
protected:同一个类中,同一个包中,不同包的子类
TODO
public:任意位置访问
*/
public static void main(String[] args) {
Student stu =new Student();
stu.age=23;
stu.show();
}
}
代码02
public class Student { int age; public void show(){ System.out.println("show..."); } }
运行结果
show...