There's no reason why you shouldn't be able to use a class which extends another class and implements multiple interfaces as class type for an anonymous inner class . There are some differences in using anonymous inner classes in contrast to regular classes but I don't know of any restriction regarding inheritance or interface implementation.
But your code example doesn't even use an anonymous class. Your holding a reference "t" for what you suppose to be an anonymous class. You can see lots of examples of using anonymous inner classes in Swing code regarding event listeners. There you often instantiate an anonymous class with operator "new" directly where it is consumed as a parameter to a method without holding a reference to it.
Perhaps I missed your question but I don't really see what's the problem here with anonymous inner classes?!?
Joined: Sep 20, 2005
i was just solving one of the K&B exercises for Inner Classes.. the question was which of the following are true for anonymous inner class? 1.it can extend exactly one class and implement exactly one interface 2."" "" "" "" "" "" "" can implement multiple interfaces 3."" "" "" "" "" "" or implement exactly one interface 4.some clearly wrong option 5.some clearly wrong option
the correct answer given is option 3..that's what i chose too
I'm still convinced that you can create an anonymous class of every class or interface type. So in my opinion it clearly could be any class which extends another class and implements multiple interfaces.
You can also directly instantiate an interface with "new" and implement this interface in-place. Then of course it can only be one interface. Perhaps it's this what the question tries to find out... or I am really wrong with this.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com