indra negi wrote:
If we create a new method in an anonymous inner class then how will we invoke that method as we can't use the instance of the super class.
Please explain with an example.
If you can't use the super class (or an interface) to call the method, then your only option is to use reflection, as the definition of the anonymous class will be out of scope.
Here's a quick modification of the previous example, that uses refection instead...
Henry