简体   繁体   English

来自JDK,JRE的内部,嵌套,本地和匿名类的示例

[英]Examples of inner, nested, local and anonymous classes from JDK, JRE

I find a very useful to read this question: Java inner class and static nested class , but can't find there any example from Java. 我发现阅读此问题非常有用: Java内部类和静态嵌套类 ,但是找不到Java的任何示例。 Could you provide me with real examples of using those classes from JDK, JRE? 您能为我提供使用JDK,JRE中的那些类的真实示例吗?

Nested classes (static inner) do not have a reference to outer context. 嵌套类(静态内部)没有对外部上下文的引用。 Map#Entry is an example of such nested class -- it contains only key, value pair properties and by definition has no access to outer Map implementation. Map#Entry是此类嵌套类的示例-它仅包含键,值对属性,并且根据定义无法访问外部Map实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM