| Author |
Anonymous Class (interface & extends)
|
faisal usmani
Ranch Hand
Joined: Jan 14, 2006
Posts: 139
|
|
Hi , Can an anonymous class be declared as implementing an interface and extending a class ? Thanx in advance
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
No. If you need to do both, then you'll need to use a named class (which could still be an inner class, just not an anonymous one.)
|
[Jess in Action][AskingGoodQuestions]
|
 |
faisal usmani
Ranch Hand
Joined: Jan 14, 2006
Posts: 139
|
|
Thanx Ernest But can you give me a little detail why is it not possible ? -No act of kindness, no matter how small, is ever wasted regards
|
 |
Ernest Friedman-Hill
author and iconoclast
Marshal
Joined: Jul 08, 2003
Posts: 24081
|
|
|
Just because the language specification provides no way to do it. I suppose the logic was that if you need to do anything that complicated, then it's worth creating a class with a name. Anonymous classes are supposed to be tiny one-liners -- anything larger belongs in a named class.
|
 |
 |
|
|
subject: Anonymous Class (interface & extends)
|
|
|