本地类是指在代码块中声明的命名嵌套类。 本地类不常见,因此可能令人困惑。 此外,有些代码标准不建议使用本地类。
示例:
void test() { class Local { // 局部类 } new Local(); }