Hello java ppl I wanted to know if we can declare an anonymous class without extending "any claess" or implementing any interface . I have tried this : new () {}; but it won't work if yes plz be kind enough to include the code Regards denish.
Hi denish, u'r q did trigger of a chain of thoughts but if u analyse u'r question from the utility point of view u will see why sun has not incorporated a provision of creating anonymous class that aren't related 2 an interface or class.This is because anon classes exist 2 create objects on 'fly' 4 a small yet specific purpose. it is 4 this reason that u override various method implementations in the anon class. Without it there would be no meaning of anon classes & an inner class implementation would better serve the purpose. I hope this helps. Regards, Kaushik
Hey Kaushik I know why java did it i was actually confirming if i am missing some thing for exam. Because for SCJP i think u never know what is enough .Thanx for the reply any way Regards Denish.
Don't get me started about those stupid light bulbs.