What’s meant by anonymous class in Java?

An anonymous class in Java is a class not given a name and is both declared and instantiated in a single statement . An anonymous class is commonly used in the Java platform where a function language would use a lambda expression. You should consider using an anonymous class whenever you need to create a class that will be instantiated only once . An anonymous class must always implement an interface or extend an abstract class. However, you don't use the extends or implements keyword to create an anonymous class. Instead, you use the following syntax to declare and instantiate an anonymous class:

 (C) 2022    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.
SiteMap  | Terms  | About