私有化外部方法访问
 public class outer {
 //外部定义的方法
 private class student {
 public void play() {
 System.out.println(“只有学生才会喜欢打篮球”);
 }
 }
 public void teacher() {
 student stu = new student();
 stu.play();
 }
 public static void main(String[] args) {
    outer s = new outer();s.teacher();
}

}