inner calss and anonymous clas 得区别
Posted istar
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了inner calss and anonymous clas 得区别相关的知识,希望对你有一定的参考价值。
Nested Class 分为inner class 和static nested class这两种。
inner class分为三种,第一种,inner calss,第二种是method inner class,第三种是anoymous inner class
其中:anoymous inner calss 分为两种,第一种是没有;无类名得 inner class类,第二类是使用参数传递的inner class,
新建的anonymous inner class直接作为一个参数进行传递。
这几种inner class 都会对outer class 进行引用的
最后的一种是outer nested class类,这个类不会引用outer class,所有不造成内部类的内存泄漏。class名字前面加个static的变量
以上是关于inner calss and anonymous clas 得区别的主要内容,如果未能解决你的问题,请参考以下文章