+ 3

Can anyone please explain me any situation where these anonymous classes are useful??

5th Jul 2018, 7:04 PM
Aditya Manchanda
Aditya Manchanda - avatar
1 Réponse
+ 1
If you are talking about Java, it is (was) commonly used to subclass `Runnable` or similar. For example maybe you have a "runInAnHour" function that runs a piece of code in an hour. Then you can runInAnHour(new Runnable(){ void run(){ // this runs in an hour } });
5th Jul 2018, 7:51 PM
Schindlabua
Schindlabua - avatar