/*
内部类常用的修饰符:
static 被静态的修饰可以直接通过类名.创建对象 new Outer2.Inner1()
private 私有的需要在创建个方法来访问
*/
//class Outer2{
// static int a1 = 10;
// private static int a2 = 11;
// public static int a3 = 12;
//
// static class Inner1{
// public void fun1(){
// System.out.println(a1);
// System.out.println(a2);
// System.out.println(a3);
// }
// }
//}
class Outer3 {
private class Inner {
public void fun1(){
System.out.println("好好学习,天天向上!");
}
}
public void show(){
Inner inner = new Inner();
inner.fun1();
}
}
public class InnerDemo2 {
public static void main(String[] args) {
// Outer2.Inner1 inner1 = new Outer2.Inner1();
// inner1.fun1();
Outer3 outer3 = new Outer3();
outer3.show();
}
}
标签:fun1,内部,Inner1,成员,public,static,day10,class,out
From: https://www.cnblogs.com/qiwei-bigdata/p/18345973