How are Anonymous inner classes used in Java?

后端 未结 18 1377
孤独总比滥情好
孤独总比滥情好 2020-11-21 05:19

What is the use of anonymous classes in Java? Can we say that usage of anonymous class is one of the advantages of Java?

18条回答
  •  梦如初夏
    2020-11-21 05:47

    Anonymous inner class can be beneficial while giving different implementations for different objects. But should be used very sparingly as it creates problem for program readability.

提交回复
热议问题