匿名内部类(Anonymous Inner Class)

在近期的Android学习中,我发现匿名内部类用的比较多,所以学习了一下java的匿名内部类

  • 内部类:是类里面的类
  • 局部内部类:类方法里面的类
  • 匿名内部类(匿名类):只能使用一次,没有名字。 使用方法:new 父类名/接口名{} 进行重写或实现 
————————

In recent Android learning, I found that anonymous inner classes are used more, so I learned the anonymous inner classes of Java

  • Inner class: it is the class inside the class
  • Local inner class: the class inside the class method
  • Anonymous inner class (anonymous class): can only be used once without a name. Usage: rewrite or implement new parent class name / interface name {}