内部类与静态内部类的使用
作者:
手打小黑板 | 来源:发表于
2020-02-12 10:07 被阅读0次package com.liming.statictest;
import org.junit.Test;
public class StaticTest {
@Test
public void main(){
A a1 = new A();
//创建内部类对象
A.BB.BBB a3 = new A().new BB().new BBB();
//调用静态内部类成员
A.AA.AAA.test();
}
}
class A{
static int sa;
int a;
//静态内部类
static class AA{
static class AAA{
static void test(){
System.out.println("Test programming");
}
}
}
//普通内部类
class BB {
class BBB {
}
}
}
本文标题:内部类与静态内部类的使用
本文链接:https://www.haomeiwen.com/subject/gryqfhtx.html
网友评论