This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
shivang sarawagi wrote:Can anyone explain me the what is happening in these lines
Welcome to anonymous classes.
When you have problems like this, it's usually good to work from the inside out. In your particular case, the "inside" is:and what that does its to create an instance of an 'anonymous' (ie, unnamed) class that implements TestA. In order to do that, it has to implement its toString() method, which in this case returns "test".