Class类别top-level nested member local anonymous inner

Nested Class, Member Class, Inner Class, Local Class, Anonymous Class, Top-level Class

 

 

1、top-level class

顶层类:不用解释

 

2、nested class

内嵌的顶层类 - nested (top-level) class:

A class defined as static inside another class. Instances can live

independent of instances of the enclosing class. It's a normal class,

just with a longer name.

就是:静态内部类,静态内部类就是一般的类,只是名字长一点而已(带上了外部类的前缀)

 

3、member class

成员内部类 - member (inner) class:

A class defined as non-static inside another class. Instances are

dependent on an instance of the enclosing class.

就是:非静态内部类,依赖外部类的实例。

 

4、local class

本地内部类 / 临时内部类 - local (inner) class:

Defined inside a code block, only visible inside that code block

就是:定义在代码块中的内部类,比如方法中定义的类。

 

5、anonymous class

匿名内部类 - anonymous (inner) class:

A local class without a name.

就是:一个没有名字的类。

 

6、inner class

内部类

A member, local or anonymous class

就是:包括了:成员内部类、本地内部类、匿名内部类。

 

 

refs: Nested Class, Member Class, Inner Class, Local Class, Anonymous Class

 

你可能感兴趣的:(Java)