In explanation for one of the questions in Dan's test,it is given that If the anonymous class extends another class then the class instance creation expression can include parameters. The parameters will be passed to a constructor of the super class. I couldn't understand it fully?Can anonymous class(which already extends some class) extend another class??!!!Can anybody explain the above with an example?
"Continuous effort - not strength or intelligence - is the key to unlocking our potential."
Hi, Anonymous classes can not extend another class. They cannot have any constructors declared. The statement should mean that, if you want to call the parameterized constructor of the super class, pass arguments while declaring the instance. Consider this simple code.
Another of way of explaining the Dan's statement is that anonymous class can either extend another class or implement an interface. He is saying if it is extending another as apposed to implementing an interface.