Why we use anonymous class in program? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why we use anonymous class in program?

28th Jun 2017, 3:48 PM
Priyanka Pawar
Priyanka Pawar - avatar
2 Answers
+ 1
Well, if you want to change slightly one of the objects of given class, you can use annonymous class. For instance you can override one of the methods in you an object.
29th Jun 2017, 5:39 PM
Łukasz Romanowski
Łukasz Romanowski - avatar
- 1
From my point of view you can declare and instantiate class at the same time.
28th Jun 2017, 5:42 PM
zdena