Hemant Khandal wrote:Now I am talking only above code.I want to call overridden method foof() from main().Is it possible ? If yes then please let me know how can we do this?
From the code, it is *not* possible. The Foo instance is created internal to the go() method. It can't be accessed from the main method.
And this doesn't have anything to do with it being an anonymous inner class, or if the method is overridden or not. The instance is just not accessible to the main method. Period. You will have to modify the go() method to expose it somehow, before the main method can access it.
Henry